Application Development 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: 

Scheduled BACK GROUND Job not getting released in SM37, not sure if it's an Authorization issue or some other issue?

Former Member
0 Kudos

Hello Experts,

We have scheduled a Back Ground Job using below FM's

JOB_OPEN,

JOB_SUBMIT,

BP_JOB_READ,

BP_JOB_MODIFY,

JOB_CLOSE

now the issue is,Job is getting created and scheduled successfully, but its not getting released, can some one suggest whether its an Authorization Issue or some other issue in the code and what needs to be done here to resolve it?

Thanks in advance..!!

Regards,

Dilli.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Which parameters did you provide to JOB_CLOSE, did you catch every exception raised by FMs?

Hint: Look at SAP provided samples in Background Processing / Programming with the Background Processing System (BC-CCM-BTC) - Scheduling a Job: Full-Control Method.

Regards,

Raymond

10 REPLIES 10

raymond_giuseppi
Active Contributor
0 Kudos

Which parameters did you provide to JOB_CLOSE, did you catch every exception raised by FMs?

Hint: Look at SAP provided samples in Background Processing / Programming with the Background Processing System (BC-CCM-BTC) - Scheduling a Job: Full-Control Method.

Regards,

Raymond

0 Kudos

Yes Raymond,

We have caught all the exceptions from every FM, we didnt get any Exceptions  for  any FM,i mean we got the value of Sy-subrc  as 0  for all the FM's.

Below is our code for JOB_CLOSE FM. Job is getting Scheduled, but not getting Released.

CALL FUNCTION 'JOB_CLOSE'

     EXPORTING

       jobcount             = number

       jobname              = name

       strtimmed            = 'X'

    IMPORTING

       JOB_WAS_RELEASED     = w_released

     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.


Kindly help if we need to do some code change to get the JOB released    OR


suggest  if its an issue with below Authorization Objects ?



S_BTCH_NAM

S_BTCH_ADM

S_BTCH_JOB: Action=RELE



Regards,

Dilli.

0 Kudos

Can you release any JOB manually via SM36? Check for Authorization issue also via SU53/SU24.

0 Kudos

Job starts only immediately if user has the RELE authorization.

0 Kudos

Did you execute SU53 or a trace of authorization thru ST01?

Hint: Did you 'play' with some user name not equal to actual user or this is the first time this user schedule ajob, in this case check value returned in JOB_WAS_RELEASED, if not equal to 'X' current user isn't allowed and an admin should release the job. (Read documentation of the returned parameter)


  IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ELSEIF l_released = space.

    MESSAGE s157(oiucm).

  ENDIF

For info


We have caught all the exceptions from every FM

A long time ago, an exception was triggerd, CANT_START_IMMEDIATE, exception which has been replaced by the export parameter...

Regards,

Raymond

alexander_bolloni
Contributor
0 Kudos

Hello,

why do you do BP_JOB_READ and BP_JOB_MODIFY before JOB_CLOSE?

You should be able to control all job attributes using OPEN,SUBMIT,CLOSE

Maybe whatever you do with MODIFY has something to do with it...

Regards,

  Alex

0 Kudos

Hi Raymond,

Actually  USER who is not the main User(user with all authorizations) is an END USER, so the Back ground Job  Scheduling authorizations can't be given to this user( confirmed the same with SECURITY team),so we have coded as below.

When calling the Job_Submit FM we are passing USER2(who have all the authorizations) to  EXPORTING parameter authcknam as this is the parameter where authorization is checked as below.

CALL FUNCTION JOB_SUBMIT

EXPORTING

authcknam =  'USER2'( who have all the authorizations)

IMPORTING

..........................

EXCEPTIONS

...........................



As you said the JOB_WAS_RELEASED should be 'X; if it gets released, but in our case its coming as blank.



So still the Job is getting scheduled, but not released.


Kindly suggest if any code change need to done to resolve this.


Regards,

Dilli.

0 Kudos

Hi Alexander,

Earlier JOB was not getting Scheduled at all, JOB_SUBMIT was returning RC8 when executed.

As per the suggestion from below post we have used BP_JOB_READ and BP_JOB_MODIFY before JOB_CLOSE  to resolve the issue.


So now we are not getting any issue i.e JOB is getting scheduled, but not getting released.

Please suggest if  any change need to be done.

Regards,

Dilli.

0 Kudos

That would be a security vulnerability, a bug, you should not be able to cheat the system ..

You should create a periodic background job that would release these jobs,

  • Create an event SM64
  • Create a backgroun job SM36 (periodic on event)
  • Raise the event in your program with FM BP_EVENT_RAISE

Regards,

Raymond

0 Kudos

It's an Authorization Issue. Now we secured the required authorizations and the issue was resolved.

Thank you all..!!