‎2009 May 11 8:00 AM
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
‎2009 May 11 8:22 AM
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
‎2009 May 11 8:03 AM
try to execute your report with restricted values..that is fill entries in selection screen fields
‎2009 May 11 8:04 AM
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
‎2009 May 11 8:12 AM
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
‎2009 May 11 8:12 AM
HI SWATI,
instead of using join why dont go for all entries
it will be give better performance
regards
afzal
‎2009 May 11 8:13 AM
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
‎2009 May 11 8:22 AM
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
‎2009 May 11 9:16 AM
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
‎2009 May 11 11:37 AM
‎2009 May 11 8:30 AM
Execute the report in Background, that way you can avoid timeout error.
‎2009 May 11 8:35 AM
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
‎2009 May 11 9:49 AM
Hi,
See the below link.
[https://www.sdn.sap.com/irj/scn/forums]
Regards,
Naveen M.
‎2009 May 11 9:58 AM
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