Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

program in batch mode-adding security to batch id

Former Member
0 Likes
573

Hi,

i need to run a program in batch mode and security for it need to be added to the batch id.could come one let me know how to do that with some sample code.

Your help would be appreciated.

Thanks,

ravi.

3 REPLIES 3
Read only

Former Member
0 Likes
523

Hi

you can use a code like this:

  • Open job:

VA_JOBNAME = .......

CALL FUNCTION 'JOB_OPEN'

EXPORTING

JOBNAME = VA_JOBNAME

IMPORTING

JOBCOUNT = VN_JOBCOUNT

EXCEPTIONS

CANT_CREATE_JOB = 1

INVALID_JOB_DATA = 2

JOBNAME_MISSING = 3

OTHERS = 4.

  • Call program

SUBMIT <REPORT>

USER SY-UNAME

VIA JOB VA_JOBNAME NUMBER VN_JOBCOUNT

WITH ...

WITH ....

WITH ..... AND RETURN.

  • Close job

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

JOBCOUNT = VN_JOBCOUNT

JOBNAME = VA_JOBNAME

STRTIMMED = 'X' " start immediatly

EXCEPTIONS

CANT_START_IMMEDIATE = 1

INVALID_STARTDATE = 2

JOBNAME_MISSING = 3

JOB_CLOSE_FAILED = 4

JOB_NOSTEPS = 5

JOB_NOTEX = 6

LOCK_FAILED = 7

OTHERS = 8.

But you can also do it by trx SM36

Max

Read only

Former Member
0 Likes
523

Max,

Thanks for your response.

if i want to use this code in the same program which i need to submit in background, what changes do i need to make.

Thanks,

ravi.

Read only

Former Member
0 Likes
523

Hi

If you want to add security to a program you may use

AUTHORITY-CHECK statement with a particular object .

But the BATCH ID user should have authorization for the object you choose . Other users may not have authorization. Depends on what level of security you want to Add. So you will have to identify an authorization object and an activity .