Skip to Content
author's profile photo Former Member
Former Member

Report Background Scheduling

Hi All,

I got a requirement that when ever we execute a program. say suppose there are total 100 lines in the program, the first 80 lines should execute in foreground and rest of the lines shold execute in Background.

Any reply will be encouraged

regards

NSK

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 15, 2008 at 04:46 AM

    Hi,

    You can try this. In your report have a parameter PA_BKGND with NO-DISPLAY addition.The last 20 line of your code should get executed when this parametere is filled and first 80 should get executed when its blank. in the First 80 line , Do your stuff and then submit your report in Background with the PA_BKGND Set.

    Report Ztest

    If PA_BKGND is INITIAL.

    • First 80 lines

    SUBMIT ZTEST with PA_BKGND = 'X'

    ELSE.

    Last 20 lines.

    ENDIF.

    Another way can be to put the last 20 lines in an FM call the FM in BACKGROUND Task.

    Regards

    Saket Sharma

    Edited by: Saket Sharma on Jun 15, 2008 6:48 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 15, 2008 at 02:24 PM

    If i understand ur requirement correctly then you want to execute 80 lines of ur code in online mode and 20 lines in background mode. You can achieve it by following way:

    Report z_example.

    if sy-batch = space.

    • Put 80 lines of ur code (need to be executed in online mode)

    • Execute prog. in background

    CALL FUNCTION 'JOB_OPEN'

    EXPORTING

    jobname = name

    IMPORTING

    jobcount = number

    EXCEPTIONS

    cant_create_job = 1

    invalid_job_data = 2

    jobname_missing = 3

    OTHERS = 4.

    IF sy-subrc = 0.

    SUBMIT z_example TO SAP-SPOOL

    SPOOL PARAMETERS print_parameters

    WITHOUT SPOOL DYNPRO

    VIA JOB name NUMBER number

    AND RETURN.

    IF sy-subrc = 0.

    CALL FUNCTION 'JOB_CLOSE'

    EXPORTING

    jobcount = number

    jobname = name

    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.

    ...

    ENDIF.

    ENDIF.

    ENDIF.

    else.

    • Put rest 20 lines of code (need to be executed in background mode)

    endif.

    Regards,

    Joy.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.