Application Development and Automation 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: 
Read only

Time out?

Former Member
0 Likes
402

Hello!

I have more then 1 mln. rows in my db. If I write "loop' statement I have time out error.

Does anybody have any idea, how I can loop the db without time out error?

And I have a question yet. I have a "select" statement and I have to write "commit work" inside it. I know it's not possible. Is there any alternate statement for "commit work" in the "select statement"?

Thanks!

1 ACCEPTED SOLUTION
Read only

agnihotro_sinha2
Active Contributor
0 Likes
370

hi,

You can use the OPEN CURSOR concept. It reduces execution time to a lot extent.

OPEN CURSOR C1 FOR

SELECT mblnr mjahr zeile bwart matnr werks lgort charg lifn

kunnr shkzg waers dmbtr menge

FROM mseg WHERE matnr IN ra_fert

AND mseg~werks IN ('IN00','IN09','IN02','IN08') "M1

AND mseg~lgort IN it_mseg_lgort

AND mseg~bwart IN ('301','302')

AND mseg~charg IN ('A','B','C','D')

AND mseg~lifnr EQ space.

DO.

CLEAR GWA_MSEG.

FETCH NEXT CURSOR C1 INTO CORRESPONDING FIELDS OF GWA_MSEG.

IF SY-SUBRC = 0.

APPEND GWA_MSEG TO GIT_MSEG.

ELSE.

CLOSE CURSOR C1.

EXIT.

ENDIF.

ENDDO.

ags.

2 REPLIES 2
Read only

Former Member
0 Likes
370

You can follow the below steps to avoid timed out error.

1. Optimise the select query on DB table by giving the appropriate conditions in the WHERE clause.

2. Try to run the report in background mode.

Thanks,

Sowmya

Read only

agnihotro_sinha2
Active Contributor
0 Likes
371

hi,

You can use the OPEN CURSOR concept. It reduces execution time to a lot extent.

OPEN CURSOR C1 FOR

SELECT mblnr mjahr zeile bwart matnr werks lgort charg lifn

kunnr shkzg waers dmbtr menge

FROM mseg WHERE matnr IN ra_fert

AND mseg~werks IN ('IN00','IN09','IN02','IN08') "M1

AND mseg~lgort IN it_mseg_lgort

AND mseg~bwart IN ('301','302')

AND mseg~charg IN ('A','B','C','D')

AND mseg~lifnr EQ space.

DO.

CLEAR GWA_MSEG.

FETCH NEXT CURSOR C1 INTO CORRESPONDING FIELDS OF GWA_MSEG.

IF SY-SUBRC = 0.

APPEND GWA_MSEG TO GIT_MSEG.

ELSE.

CLOSE CURSOR C1.

EXIT.

ENDIF.

ENDDO.

ags.