‎2008 Jun 15 5:40 AM
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
‎2008 Jun 15 5: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
‎2008 Jun 15 5: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
‎2008 Jun 15 3: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.