cancel
Showing results for 
Search instead for 
Did you mean: 

refreshing the data

Former Member
0 Kudos

hi,

i am retreiving the data from sap fine....via jco

i want to retrieve the data every 1 hour , means every 1 hour it goes and

fetches the data , so, i want time interval ....

plz send me necessary code...........

thanks,

swathi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Tony,

One possible way could be to create a thread that has a continuous loop with a sleep statement in it. I've used something similar for updating transaction data into SAP from a standalone appliction. You can then control this thread from your main thread and start it/stop it/set the refresh rate etc.

Gareth.

Former Member
0 Kudos

hi,

yes, it is fine....

but i dont know that coding part ....

plz write necessary code to refresh until some period of time...

thanks,

tony

Former Member
0 Kudos

Hi tony,

you can try this:

TimerTask timerTask = new TimerTask()

{

public void run()

{

// Your code

}

};

Timer timer = new Timer();

timer.scheduleAtFixedRate(timerTask, 0, 1000);

check the documentation:

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Timer.html

http://java.sun.com/j2se/1.4.2/docs/api/java/util/TimerTask.html

Best,

Ignacio.

Former Member
0 Kudos

hi,

timer.scheduleAtFixedRate(timerTask, 0, 1000);

here 1000 means 1 hr or any thing else i cant understand

every 1 hr it executed the run() method...

plz tell me clearly............................

thanks

Former Member
0 Kudos

0 = delay in milliseconds before task is to be executed.

1000 = time in milliseconds between successive task executions.

if you want to run the task every one hour you should have to set the last parameter in 3600000.

timer.scheduleAtFixedRate(timerTask, 0, 3600000);

Best,

Ignacio.

Former Member
0 Kudos

hi Ignacio,

fine information u have given,, thanks..............

Answers (0)