2007 Oct 05 3:42 PM
Hi everyone,
I have an alv report.when the user clicks a toolbar button on alv report some transaction runs in the background.When the user again clicks again the same button while still the background job is running i need to pop up a error message saying that already background job is running for this routine.How can i do that?any sample code please?
Thank you.
2007 Oct 05 3:47 PM
HI,
If the user Press the Button, then check whether the background is running , if the nackground is running then raise a pop-up and give a mesage saying that 'A background program is still running'.
to check whether the Background is running or not ---> Goto Table TBTCO, then give the Job name and get the status, if the status is still running then give the message, if the status is completed then run the job
Regards
Sudheer
2007 Oct 05 3:49 PM
Hi sudheer,
Can u give me any sample code so that that will be clear to me?
2007 Oct 05 4:29 PM
Hi,
write following code after the button click action:
select * from tbtcp into table i_tbtcp where progname = 'ZXXXXX'.
if sy-subrc = 0.
loop at i_tbtcp.
if i_tbtcp-status = 'R'.
message for program already running
endif.
endloop.
endif.
2007 Oct 05 3:47 PM
Just keep track of whether or not the transaction has been submitted. If it has, give an error.
Rob
2007 Oct 05 3:48 PM
Hi
In the Interactive Event for that Button call the transaction SM36 by scheduling that Job by calling the fun module JOB_OPEN,...JOB_CLOSE..
and when next time pressed write a select for the tables
TBTCP,TBTCO,TBTCS and fetch the data for that program and job, it will give the SJOB status
based on the status you can call a Progress Indicator fun module or popup to display the status of the job
Regards
Anji