Application Development and Automation 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: 
Read only

Need help in batch processing

Former Member
0 Likes
679

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

5 REPLIES 5
Read only

Former Member
0 Likes
641

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

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
641

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.

Read only

0 Likes
641

How to run a trace of a program which is called in Background job?

-Priya

Read only

0 Likes
641

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

Read only

0 Likes
641

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