‎2010 Nov 11 9:00 AM
Hi all,
I have called a program in background...with immediate effect for printout.
But its taking a very long time to print.( almost 2hrs to complete the job)..
Find the code below..and correct me where it is set wrong.
DATA: l_jobcount TYPE tbtcjob-jobcount.
DATA: l_jobname TYPE tbtcjob-jobname.
DATA: l_prueflos TYPE qals-prueflos.
GET PARAMETER ID 'QLS' FIELD l_prueflos.
indx-usera = sy-uname.
indx-srtfd = l_prueflos.
indx-pgmid = 'Z1664'.
CONCATENATE sy-uname l_prueflos INTO l_jobname.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = l_jobname
IMPORTING
jobcount = l_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 z1655rep
USER sy-uname
VIA JOB l_jobname
NUMBER l_jobcount
WITH p_inslot = l_prueflos
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = l_jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
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.Thnks,
Priya
‎2010 Nov 11 9:11 AM
Hi Priya,
Try to replace the SUBMIT statement with the below statement.
DATA : l_valid,
ls_params LIKE pri_params.
*--Get Print Parameters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
IMPORTING
valid = l_valid
out_parameters = ls_params.
IF ls_params-primm IS INITIAL.
ls_params-primm = 'X'.
ENDIF.
SUBMIT z1655rep
USER sy-uname
VIA JOB l_jobname
NUMBER l_jobcount
WITH p_inslot = l_prueflos
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS ls_params
AND RETURN.
Let me know in case of any.
Regards,
Srinivas
‎2010 Nov 11 9:13 AM
The runtime depends on what you are fetching inside the submit program. Runa trace for the program and check the costly abap statements and impove them.
‎2010 Nov 11 9:23 AM
How to run a trace of a program which is called in Background job?
-Priya
‎2010 Nov 11 9:28 AM
Hi
Before checking the trace you should give a look to that program in order to understand what it does, then u can check the program while running by SM50, here you should find out the bottleneck
Max
‎2010 Nov 11 10:50 AM
Hi,
First time when I run the job it took long time(20 mnts)...Again I ran the job it took just 1 mnt( ideal time)..
Can Any one..pls tell me wht would be the probable reason?
Regs,
Priya