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: 

please clarify this questions

Former Member
0 Kudos

Hi all,

1) How to set background job using Presentation server file.

2) IF my Presentation server Is switch off is it file process and how it will process

please explain with the examples

regards,

rakesh

3 REPLIES 3

Former Member
0 Kudos

hi there...

- Create a job using function module JOB-OPEN

- Collect the job specifications.

- Add a job step to the job with the function module JOB-SUBMIT.

- Close the job and pass it to Background processing system for execution with the function module JOB-CLOSE

- EVENT DRIVEN BATCH JOBS :-

- Types = System events u2013 triggered when activation of new operation mode takes place

- User events - Triggered from ABAP/4 or external program.

- Triggering an event notifies the background processing that named condition has been reached. The Background system reacts by starting any jobs that were waiting for the event.

Transaction codes related to background jobs creation and processing are :-

SM36(Job creation)

SM37(Job selection and execution).

What are presentation and application servers in SAP?

-A presentation server is actually a program named Sapgui.exe. It is usually installed on a useru2019s workstation.

- Application server is a set of executables that collectively interpret the ABAP/4 programs and manage the input & output for them.

do reward if helpful.

Former Member
0 Kudos

Hi,

1) You can't

2) It won't

Regards,

Nick

Former Member
0 Kudos

Hi Rakesh,

We schedule a job to run a particular prog in background. i fyou are using presentation server file,then you have to upload it to sap . or if it is in application server then you can use FM 'SUBST_GET_FILE_LIST' then you can schedile a job.

we do it using Fm's JOB_OPEN , JOB_SUBMIT , JOB_CLOSE.

for this we create a variant for the program (in which we have the files)..pass it on to the above FM's.

Now we can execute the prog in foreground or background.

to schedule a job and make it run at specific time we can go for SM36 and check in SM37.

If you schedule it in SM36 and even your presentation server is closed files get processed as , you have already given a program name while scheduling and it has a variant which gives the path where files are stored.

for example, please follow the code..

***to open a file present in application server.**

OPEN DATASET l_in_filename IN TEXT MODE ENCODING NON-UNICODE FOR INPUT.

IF sy-subrc = 0.

DO.

READ DATASET l_in_filename INTO wa_info_ax_asc.

v_ent_id = wa_info_ax_asc+12(5).

v_run = wa_info_ax_asc+35(6).

CONCATENATE v_run v_ent_id+1(*) INTO v_run.

ENDIF.

EXIT.

ENDDO.

ELSE.

v_subrc = sy-subrc.

MESSAGE i229.

wa_email_msg = text-t05.

CONCATENATE l_in_filename wa_email_msg INTO v_mail_msg SEPARATED BY ':'.

APPEND v_mail_msg TO it_email_msg.

CLEAR v_mail_msg.

ENDIF.

CLOSE DATASET l_in_filename.

IF NOT v_subrc IS INITIAL.

EXIT.

ENDIF.

job_name = 'job_cust'.

CONCATENATE l_v_temp1 l_v_temp2 INTO v_filename.

  • APPEND wa_file_name TO it_file_name.

*************creating variant for custom program***********

REFRESH it_par.

v_prog = 'Zprog1'.

PERFORM create_variant USING v_ent_id v_prog.

v_variant = v_cust_variant.

*************job scheduling***********

wa_job-file = wa_file-name.

PERFORM job_open.

PERFORM job_perform USING v_variant v_prog job_name.

CLEAR wa_job.

v_subrc_1 = sy-subrc.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = v_job_name (arbitary)

IMPORTING

jobcount = v_number

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

CALL FUNCTION 'JOB_SUBMIT'

EXPORTING

authcknam = sy-uname

jobcount = v_number

jobname = v_job_name

report = p_v_prog

variant = p_v_variant

EXCEPTIONS

bad_priparams = 1

bad_xpgflags = 2

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = v_number

jobname = v_job_name

strtimmed = 'X'

  • pred_jobcount = v_pred_job

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.

invalid_jobdata = 3

jobname_missing = 4

job_notex = 5

job_submit_failed = 6

lock_failed = 7

program_missing = 8

prog_abap_and_extpg_set = 9

OTHERS = 10.

FORM create_variant_prcc USING p_v_ent_id p_v_prog.

REFRESH: it_par_prcc,

it_varit_prcc.

CLEAR wa_par_prcc.

CONCATENATE sy-uname sy-datum v_lind INTO v_prcc_variant .

wa_par_prcc-selname = 'file_path'.

wa_par_prcc-kind = 'P'.

wa_par_prcc-option = 'EQ'.

wa_par_prcc-low = p_v_ent_id.

APPEND wa_par_prcc TO it_par_prcc.

revert if any queries,

please reward if helpful..

regards,

Dinesh.