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: 

Forcing or defaulting program to background

Former Member
0 Kudos

I have a question regarding the possibility to force or default a SAP standard application execution to being a background execution.

It is possible to chose execute in background from the menu in a selection screen (F9) as an altenative to direct processing (F8).

Is it possible to make this the default execution mode without having to do a modification of a SAP standard application?

Thank you in advance

5 REPLIES 5

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Just try this.

In this,I want to schedule the program to execute in background dynamically.

I have two programs ztest1 and ztest2.

The user will execute program ztest1 and the user wants that

ztest2 program should be automatically scheduled in the background.

Use job_open, job_close & submit

    • ZTEST1

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = jobname

IMPORTING

jobcount = jobcount

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

SUBMIT ZTEST2 AND RETURN

USER sy-uname VIA JOB jobname

NUMBER jobcount

with p_zcycle = pzcycle

WITH p_area = wa_record-area.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = jobcount

jobname = jobname

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

OTHERS = 8.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

0 Kudos

Please note, that I'm talking about a SAP standard application where I do not want to make any modifications and another criteria is that the user must still be able to use the standard selection screen for inputting search criteria and other inputs.

0 Kudos

Hi Michael,

i think you're looking for fm <b>K_BATCH_REQUEST</b>

regards Andreas

Former Member
0 Kudos

Unfortunately I have not found a solution where I do not need to make any modifications, but I have found a fairly easy approach with a modification.

I'm going to modify the program in question, the modification is going to be that I'll dynamically modify the GUI status of the standard selection screen, so that the default execute function code is going to be SJOB instead of ONLI. This does require a modification of the program but is very simple and should be easy to handle in an update situation.

0 Kudos

Hi Michael,

Now that you have found a solution to this problem, can you mark this thread as answered by choosing the option "Solved it on my own". ? You may also want to reward the answers given if they have been helpful to you.

regards,

Anand Mandalika.