‎2009 Jun 24 11:22 AM
Hi all
I have a requirement where i need to display an error message when my report is taking more than thirty min to generate.
Can anyone please help me in this regard.
I need to capture the execution time and display the message at runtime.
Thanks in advance.
‎2009 Jun 25 7:17 AM
I Know this is the foolish way to fullfill ur requirement for time being
u can test following piece of code in ur program....
data: l_var1 type uzeit,
l_var2 type uzeit,
l_var3 type uzeit.
in intialization or start-of-selection
l_tm1 = sy-uzeit.
after that write following piece of code in 3 or 4 place where u thought that these
are time consuming steps
l_var2 = sy-uzeit.
l_var3 = l_var2 - l_var1.
if l_var3 ge 1800.
message e999(oo) with 'timeout'.
endif.
‎2009 Jun 25 7:17 AM
I Know this is the foolish way to fullfill ur requirement for time being
u can test following piece of code in ur program....
data: l_var1 type uzeit,
l_var2 type uzeit,
l_var3 type uzeit.
in intialization or start-of-selection
l_tm1 = sy-uzeit.
after that write following piece of code in 3 or 4 place where u thought that these
are time consuming steps
l_var2 = sy-uzeit.
l_var3 = l_var2 - l_var1.
if l_var3 ge 1800.
message e999(oo) with 'timeout'.
endif.
‎2009 Jun 25 7:23 AM
‎2009 Jun 25 7:44 AM
Andreas,
Can u please explain it in detail ? I had a look at the function module but i am unable to understand hoe would it be helpful in my case.?
‎2009 Jun 25 12:08 PM
Hi Shilpa
U can use SAPGUI_PROGRESS_INDICATOR for displayin clock in as display in standard programs
bu passing ..u can define p_rate at diffrent place of ur program in p_txt Cusomize message will display
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
percentage = p_rate
text = p_text.
start-of-selection
p_rate = 0 .
perform f_get_clock.
perform f_clock_display.
...............
again some piece of code
p_rate = 10 .
perform f_get_clock.
perform f_clock_display.
.....
............
p_rate = 20 .
perform f_get_clock.
perform f_clock_display.
form f_get_clock .
if p_rate = 0.
p_text = 'Checking for Whether File Exsists or Not'.
elseif p_rate = 10.
p_text = 'Transforming Data From File to internal Table'.
elseif p_rate = 20.
p_text = 'Formatting Data in the Internal Table'.
elseif p_rate = 30.
p_text = 'Removing Inactive,Not in SAP,Discharged Cases'.
elseif p_rate = 40.
p_text = 'Removing Exsisting Records'.
elseif p_rate = 50.
p_text = 'Checking For Public Holiday Condition'.
elseif p_rate = 60.
p_text = 'Adjusting Leave According to Leave Quata Avail'.
elseif p_rate = 70.
p_text = 'Uploading Records'.
elseif p_rate = 80.
p_text = 'Modifying Records created with .88 and .57'.
elseif p_rate = 90.
p_text = 'Writting Log Report'.
endif.
endform.
form f_clock_display .
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
percentage = p_rate
text = p_text.
endform.
‎2009 Jun 25 12:10 PM
This function module just brings some beutyfication in ur program and nothing else..
‎2009 Jun 25 12:34 PM
Hi,
adding to the information given above: there will be a default timeout set by the BASIS. after this time period the report will automatically give a short dump stating the reasons for the timeout. you can check with your BASIS team to see what is the time sttings defined in your system.
‎2009 Jun 25 12:44 PM
Its simple use
"GET RUNTIME"
use a variable say t1 befre processing starts
and t2 and processing ends
get runtime = t2 - t1 .
if get runtime is > 30 mins "error message"
hope ths helps
Bhanu
‎2009 Jun 25 1:04 PM
Your program cannot run for 30mins in foreground.....it usually times out after 5 mins...
So I dont think generation will ever take 30 mins. atleast in foreground..
Please contact your BASIS guy for assistance on this! He can increase the time out value for you...but I doubt whether 30 mins is feasible...
Do you want to cancel the job automatically...once the program has reached 30 mins for generation (in background).