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: 

Background Jobs

Former Member
0 Kudos

Hi all,

can any on epls explain me how to assign programs and bdcs in background.

3 REPLIES 3

Former Member
0 Kudos

Hi

Check out these links:

<u>http://www.geekinterview.com/question_details/18168</u>

<u>http://techpreparation.com/sap-bdc-interview-questions-answers.htm</u>

Thanks

Vasudha

jj
Active Contributor
0 Kudos

You can schedule a program in background using

Tcode: SM36

There give a job name

and press enter and give the abap program name

or use job wizard button

Former Member
0 Kudos

Hi

Method 1: in SE38

type your program name

choose Program -> Execute -> Background

Method 2: in SM36

Create a job with your program name

it will run in bg

We can Run an ABAP Program in Background but only Executable program i.e Report.

1. Tcode SE38.

Create the Variant with Required selection criteria.

2. Tcode SM36

Create a Background Job

Create a Step and Assign the Report and Variant.

Set the Start Condition (Date & Time )

Save the Job.

3. Monitor the jOB Status in Tcode SM37

This is how to do it through code

data: lv_job_name like tbtco-jobname,

lv_job_nr like tbtco-jobcount,

lv_job_released type c,

lv_job_start_sofort type c,

lv_print_parameters type pri_params.

lv_job_name = 'Z_test'. " your background program name

call function 'JOB_OPEN'

exporting

jobname = lv_job_name

importing

jobcount = lv_job_nr

exceptions

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

others = 4.

if syst-subrc = 0.

*submit job with all the selection screen params...

submit (lv_job_name)

with applfile = applfile

with p_lines = p_lines

with rfc_dest = rfcdest

with p_selmtd = lv_selmtd

with px_shsim = px_shsim

with px_sherr = px_sherr

user syst-uname

via job lv_job_name number lv_job_nr and return.

if sy-subrc = 0.

call function 'JOB_CLOSE'

exporting

jobcount = lv_job_nr

jobname = lv_job_name

strtimmed = 'X'

importing

job_was_released = lv_job_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.

if syst-subrc <> 0.

message i162(00) with

'An error occured while closing the background job.'.

stop.

endif.

endif.

endif.

skip 1.

write: / 'Background process', lv_job_name ,

'called successfully' no-gap.

write: / 'You can check the job in transaction SM37'.

<b>Reward ifusefull</b>