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

Runtime error : Time out

Former Member
0 Likes
1,799

Hi experts...

I am trying to execute one program in production.. its giving me runtime error timed out....

I am giving you line on which it is showing runtime error...

Please check it n suggest me how can we optimize this code to avoid the same error...

SELECT afko~aufnr afko~aufpl afko~rueck afpo~matnr
  INTO   CORRESPONDING FIELDS OF TABLE it_temp_orders
  FROM   afko
  INNER  JOIN afpo ON
         afpo~aufnr = afko~aufnr
  WHERE  afko~aufnr  IN  s_aufnr
  AND    afko~dispo  IN  s_dispo
  AND    afpo~matnr  IN  s_matnr
  AND    afpo~dwerk  IN  s_werks
  AND    afpo~dauat  IN  s_auart.

  SORT it_temp_orders BY aufnr aufpl matnr rueck.

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,574

Hi Swati,

Did you try with For all entries like this...!


SELECT aufnr aufpl rueck 
  INTO table it_temp_orders " decalre a new table with the same sequence of DB table & Avoid Corresponding fields
  FROM afko
  WHERE  aufnr  IN  s_aufnr
  AND    dispo  IN  s_dispo.


SELECT aufnr aufpl rueck 
  INTO table it_temp_order1 " declare a new table with the same sequence of DB table & Avoid Corresponding fields
  FROM afko
  *for all entries in it_temp_orders*
  WHERE  aufnr  = it_temp_orders- aufnr
  AND    matnr  IN  s_matnr
  AND    dwerk  IN  s_werks
  AND    dauat  IN  s_auart.

 matnr

  SORT it_temp_orders BY aufnr aufpl matnr rueck.

If still error then copy the runtime again and look where this time is the select from AFKO & from AFPO,,,,

Thanks & regards,

Dileep .C

12 REPLIES 12
Read only

former_member188827
Active Contributor
0 Likes
1,574

try to execute your report with restricted values..that is fill entries in selection screen fields

Read only

0 Likes
1,574

That is not possible.. we are running it only for one day...

can we use some index to optimize selection? If yes then how can we use them...

Regards

Read only

Former Member
0 Likes
1,574

Hi,

break this into two select queries......

use the below code to do the same....

data : begin of fs_afko
              aufnr type afko-aufnr,
              aufpl type afko-aufpl,
              reuck type afko-reuck,
        end of fs_afko.

data : Begin of fs_afpo,
            aufnr type afpo-aufnr,
           matnr type afpo-matnr,
        End of fs_afpo.

data : t_afko type table of fs_afko,
         t_afpo type table of fs_afpo.


SELECT aufnr aufpl rueck 
  INTO   TABLE t_afko
  FROM   afko
  WHERE  afko~aufnr  IN  s_aufnr
  AND    afko~dispo  IN  s_dispo.

SELECT afpo~matnr
  INTO   TABLE t_afpo
  FROM   afpo
  FOR ALL ENTRIES IN t_afko
  WHERE  aufnr  =  t_afko-aufnr
  AND    afpo~matnr  IN  s_matnr
  AND    afpo~dwerk  IN  s_werks
  AND    afpo~dauat  IN  s_auart.

loop at t_afko into fs_afko.
  loop at t_afpo into fs_afpo where aufnr = fs_afko-aufnr.
    move-corresponding fs_afko to fs_temp_orders.
    move-corresponding fs_afpo to fs_temp_orders.
    append fs_temp_orders to it_temp_orders
  endloop.
endloop.

Regards,

Siddarth

Read only

Former Member
0 Likes
1,574

HI SWATI,

instead of using join why dont go for all entries

it will be give better performance

regards

afzal

Read only

Former Member
0 Likes
1,574

Hi,

If you are running it for only one day, then check whether you can introduce any date field in the 'WHERE-USED' list of select query for instance (STRMP, ETRMP etc).

Regards,

Rajesh

Read only

Former Member
0 Likes
1,575

Hi Swati,

Did you try with For all entries like this...!


SELECT aufnr aufpl rueck 
  INTO table it_temp_orders " decalre a new table with the same sequence of DB table & Avoid Corresponding fields
  FROM afko
  WHERE  aufnr  IN  s_aufnr
  AND    dispo  IN  s_dispo.


SELECT aufnr aufpl rueck 
  INTO table it_temp_order1 " declare a new table with the same sequence of DB table & Avoid Corresponding fields
  FROM afko
  *for all entries in it_temp_orders*
  WHERE  aufnr  = it_temp_orders- aufnr
  AND    matnr  IN  s_matnr
  AND    dwerk  IN  s_werks
  AND    dauat  IN  s_auart.

 matnr

  SORT it_temp_orders BY aufnr aufpl matnr rueck.

If still error then copy the runtime again and look where this time is the select from AFKO & from AFPO,,,,

Thanks & regards,

Dileep .C

Read only

0 Likes
1,574

Hi Swati,

Do not remove the join. For all entries will never give you better performance. Try to use the indexes available. Moreover, you don't have the date filter in your query. You are querying the whole table not for one day.

Regards,

Abdullah

Read only

0 Likes
1,574

there is a sticky thread at the top of the performance tuning forum. Kindly go through that thread to understand the disadvantages of for all entries in select statement.

[Check this Link|;

Regards,

Abdullah

Read only

former_member195383
Active Contributor
0 Likes
1,574

Execute the report in Background, that way you can avoid timeout error.

Read only

Former Member
0 Likes
1,574

There are 2 options : -

1 . You schedule this report in Background. If you schedule it in the Background then you will not get time out .

2. Execute the function module "TH_CHANGE_PARAMETER" before you run your report. Here in the parameter field you pass the value as "rdisp/max_wprun_time" and in the parameter value you pass the no of milisecods to which your spool time will be set. If you do so the spool time ( Or you can say Runtime ) will be incresed and you will not get the time out.

Please check this and Let me know

Regards,

Nikhil Joshi

Read only

Former Member
0 Likes
1,574

Hi,

See the below link.

[https://www.sdn.sap.com/irj/scn/forums]

Regards,

Naveen M.

Read only

0 Likes
1,574

Hi,

fetch data from AUFK...then for those entries fetch from afko/afpo this will solve to an extent.

if still it persists then u have to put ur report in background.

Regards,

Jayaram