SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Prevent user from submitting jobs more than once



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Batch Input (BDC), Background processing and Jobs
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Nov 04, 2007 4:43 pm    Post subject: Prevent user from submitting jobs more than once Reply with quote

Prevent user from submitting jobs more than once
Here is a program that was provided by SAP Hints and Tips on Configuration and ABAP/4 (http://sapr3.tripod.com). The purpose of this program is to see if a program has already been submitted and is running. If the program is running, issue an error message in the job log.

Code:

*
* Written by :
* SAP Hints and Tips on Configuration and ABAP/4
* http://sapr3.tripod.com
*
* For some background update jobs, you might want to stop the
* user from submitting the jobs twice.
*
* Do this checks to prevent the users from submitting the
* same background job twice.
*
* Perform the checks before starting your programs.
*
* Create a MESSAGE-ID, the program will issue an error message
* in the Job logs.

tables:  tbtco.  "Job status overview table

data: t_jobcnt(1) type n,
      t_sdluname like tbtco-sdluname,
      t_strtdate like tbtco-strtdate,
      t_strttime like tbtco-strttime.

select * from tbtco where jobname  = 'ZXXX'
                      and strtdate = sy-datum
                      and status   = 'R'.

    t_jobcnt = t_jobcnt + 1.
    if t_jobcnt = 1.
       t_sdluname = tbtco-sdluname.
       t_strtdate = tbtco-strtdate.
       t_strttime = tbtco-strttime.
    endif.
endselect.

if sy-subrc = 0.
   if t_jobcnt < 1.
       message e899 with t_sdluname 'have execute the program on'
                         t_strtdate t_strttime.
   endif.
endif.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Batch Input (BDC), Background processing and Jobs All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.