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: 

problem with time_out error

Former Member
0 Kudos

Hi guys,

I have this code below and I am getting a time_out error:

LOOP AT i_vbfa.

SELECT SINGLE buchk FROM vbuk INTO v_buchk

WHERE vbeln = i_vbfa-vbeln

AND buchk = 'A'.

IF sy-subrc <> 0.

DELETE i_vbfa INDEX sy-tabix.

ELSE.

SELECT SINGLE vbtyp FROM vbrk INTO v_vbtyp

WHERE vbeln = i_vbfa-vbeln.

IF v_vbtyp NE space.

DELETE i_vbfa INDEX sy-tabix.

ENDIF.

ENDIF.

ENDLOOP.

I have a select single within the loop, will it cause trigger the error? why? Thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Mark,

Generally the Time Out occurs when the program is taking more time than system execution time.

the system execution time is maintained by basis people, commonly the time is between 10-20 minutes.

if your program is taking more than that time then the time out error is raised.

avoid using select single statement in a loop.

Regards

7 REPLIES 7

KK07
Contributor
0 Kudos

hi,

for each record u r selecting the records from table that's why it is time out error.

performance way it is not suggestable.instead u can select the values and u can use read statement.

Former Member
0 Kudos

Hi Mark,

Generally the Time Out occurs when the program is taking more time than system execution time.

the system execution time is maintained by basis people, commonly the time is between 10-20 minutes.

if your program is taking more than that time then the time out error is raised.

avoid using select single statement in a loop.

Regards

0 Kudos

Thanks Mukesh!

Does the 10~20 mins is the total time execution of the program? Would you know how many micro seconds does each select single takes to retrieve the data from teh database?

Thanks!

0 Kudos

Single selects are good if they are single selects. But here you are reading a bunch of single rows. Read them all you need in an internal table, this is very much faster. Then instead of peeaking the database in the loop do a read on the internal table. If possible, use a hashed table and your performance gain will be big.

0 Kudos

Hi

I donot have much idea, but u can do SQL Trace using T.code ST05.

in that you will get what time each select statement is taking and some other details also.

Regards

Mukesh.

Former Member
0 Kudos

Hi

Create a internal table for i_vbuk with vbeln and buchk fields

and i_vbrk with vbeln and vbtyp fields.

write this before loop.

if i_vbfa[] is not initial.

select vbeln buchk into table i_vbuk for all entries in

i_vbfa where vbeln = i_vbfa-vbeln and buchk = 'A'.

select vbeln vbtyp into table i_vbrp for all entries in

i_vbrp where vbeln = i_vbfa-vbeln and vbtyp ne space.

endif.

sort i_vbuk.

sort i_vbrp.

LOOP AT i_vbfa.

read table i_vbuk with key vbeln = i_vbfa-vbeln binary search.

IF sy-subrc 0.

DELETE i_vbfa .

ELSE.

read table i_vbrk with key vbeln = i_vbfa-vbeln binary search.

IF sy-subrc 0.

DELETE i_vbfa .

ENDIF.

ENDIF.

ENDLOOP.

Regards

Madhan

Edited by: Madhan Doraikannan on Oct 8, 2008 8:59 AM

0 Kudos

>

> read table i_vbuk with key vbeln = i_vbfa-vbeln binary search.

> Edited by: Madhan Doraikannan on Oct 8, 2008 8:59 AM

In that special case i would prefer a hashed table rather then a sorted table. Read will be much faster.