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: 

Triggering a background job of class 'A' from within the ABAP program

former_member270360
Participant
0 Kudos

Dear All,

We are implementing SAP ECC 6.0 on IBM System i, i5/OS V5R4, SAP kernel 7.00, kernel patch level 173.

Is there a way to control that when a background job is triggered from within an ABAP program using the : CALL FUNCTION 'JOB_OPEN' statement, the background job is of class A ?

I know that through transaction SM37, the job class for a background job can be changed manually, but the situation is an outsource company did for us some changes in the native SAP ABAP programs related to some SAP native transactions, and those programs trigger at their end some background jobs, each job running with the name of user running the transaction.

Through SM37, I can't find a template background job, to be changed to have class 'A'

The following is an excerpt from the ABAP code, bearing the CALL FUNCTION 'JOB_OPEN' statement :

FUNCTION z_cs_technical_completion.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(AUFNR) TYPE VBRP-AUFNR

*"----


DATA jobcount TYPE tbtcjob-jobcount.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = 'CS_TECH_COMPLETE'

  • SDLSTRTDT = NO_DATE

  • SDLSTRTTM = NO_TIME

  • JOBCLASS =

IMPORTING

jobcount = jobcount

  • CHANGING

  • RET =

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4

.

SUBMIT zcs_technical_completion

WITH p_aufnr EQ aufnr

AND RETURN

VIA JOB 'CS_TECH_COMPLETE'

NUMBER jobcount.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = jobcount

jobname = 'CS_TECH_COMPLETE'

strtimmed = 'X'

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

invalid_target = 8

OTHERS = 9.

ENDFUNCTION.

Thank you in advance for your cooperation.

Best regards.

Reda Khalifa

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

The JOBCLASS parameter on the JOB_OPEN function will set the priority and there are parameters on the JOB_CLOSE function to determine when the job should start.

Darren

4 REPLIES 4

Former Member
0 Kudos

Hi,

The JOBCLASS parameter on the JOB_OPEN function will set the priority and there are parameters on the JOB_CLOSE function to determine when the job should start.

Darren

0 Kudos

Dear Darren,

Thank you very much for your cooperation and for your prompt reply.

Could you please explain to me how to find out the template background job that was first used, or in other words, how things were set up in the first place, i.e. when first the ABAP program was written and executed, there had to be at least one background job created through transaction SM36 ?

Thank you in advance for your cooperation.

Best regards.

Reda Khalifa

0 Kudos

Hi,

You'd have to read the job details from TBTCO & TBTCP tables, bearing in mind that the data in these tables probably gets cleared after 8 days or so.

Regards,

Darren

0 Kudos

Dear Darren,

Thank you very much for your cooperation.

Let me rephrase my last question :

The background job definition is hard-coded inside the ABAP program, i.e. transaction SM36 was never used to define / create that background job of interest ?

Best regards.

Reda Khalilfa