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: 

executing SUBMIT statement in background

Former Member
0 Kudos

Hello Experts,

Is it possibe in executing SUBMIT statement in backgound? If yes can anyone provide example code?

Also in terms of performance tuning how does SUBMIT fares against CALL TRANSACTION? Which is much better in terms of performance.

Appreciate your answers. Thanks!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

There's no difference for the performance:

if a transaction is assigned to a report (so no dialog program, module pool), it's better to use the SUBMIT if it needs to transfer the value on SELECTION-SCREEN. It can't do it by CALL TRANSACTION.

DATA: VA_JOBNAME LIKE TBTCO-JOBNAME, 
           VN_JOBCOUNT LIKE TBTCO-JOBCOUNT.

* Open job
  CALL FUNCTION 'JOB_OPEN'
       EXPORTING
            JOBNAME          = VA_JOBNAME
       IMPORTING
            JOBCOUNT         = VN_JOBCOUNT
       EXCEPTIONS
            CANT_CREATE_JOB  = 1
            INVALID_JOB_DATA = 2
            JOBNAME_MISSING  = 3
            OTHERS           = 4.
  CASE SY-SUBRC.
    WHEN 0.
    WHEN OTHERS.
      MESSAGE E208(00) WITH 'Error.
  ENDCASE.

* Call report
  SUBMIT <REPORT>  USER SY-UNAME
                    VIA JOB VA_JOBNAME NUMBER VN_JOBCOUNT
                    WITH ..................................
                    AND RETURN.
* Close job

  CALL FUNCTION 'JOB_CLOSE'
       EXPORTING
            JOBCOUNT             = VN_JOBCOUNT
            JOBNAME              = VA_JOBNAME
            STRTIMMED            = 'X'  " start immediatly
       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.

Max

5 REPLIES 5

Former Member
0 Kudos

Hi

There's no difference for the performance:

if a transaction is assigned to a report (so no dialog program, module pool), it's better to use the SUBMIT if it needs to transfer the value on SELECTION-SCREEN. It can't do it by CALL TRANSACTION.

DATA: VA_JOBNAME LIKE TBTCO-JOBNAME, 
           VN_JOBCOUNT LIKE TBTCO-JOBCOUNT.

* Open job
  CALL FUNCTION 'JOB_OPEN'
       EXPORTING
            JOBNAME          = VA_JOBNAME
       IMPORTING
            JOBCOUNT         = VN_JOBCOUNT
       EXCEPTIONS
            CANT_CREATE_JOB  = 1
            INVALID_JOB_DATA = 2
            JOBNAME_MISSING  = 3
            OTHERS           = 4.
  CASE SY-SUBRC.
    WHEN 0.
    WHEN OTHERS.
      MESSAGE E208(00) WITH 'Error.
  ENDCASE.

* Call report
  SUBMIT <REPORT>  USER SY-UNAME
                    VIA JOB VA_JOBNAME NUMBER VN_JOBCOUNT
                    WITH ..................................
                    AND RETURN.
* Close job

  CALL FUNCTION 'JOB_CLOSE'
       EXPORTING
            JOBCOUNT             = VN_JOBCOUNT
            JOBNAME              = VA_JOBNAME
            STRTIMMED            = 'X'  " start immediatly
       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.

Max

former_member435013
Active Participant
0 Kudos

Hi,

Submit is for reports. And normally reports are used for jobs.

Transaction are used for dialogs primary. With call transaction in background you have to provide batch input data with it.

In general you should prefer reports for background processing since performance.

But sometimes you can't fit requirements without using batch input (bdc).

Example:

SUBMIT RSNAST00 and return

WITH P_AGAIN eq p_again

WITH P_PRINT eq p_print

WITH P_SORT eq p_sort

WITH P_SUFF2 eq p_suff2

WITH S_KAPPL in s_kappl

WITH S_KSCHL in s_kschl

WITH S_NACHA in s_nacha

WITH S_OBJKY in s_objky.

Regards

Walter Habich

0 Kudos

SUBMIT rm07mbst

WITH SELECTION-TABLE gt_rsparams

WITH bukrs IN s_bukrs "company code

WITH skont IN s_skont "GL account

WITH bwkey IN s_bwkey "Valuation area

WITH bwtar IN s_bwtar "Valuation type

WITH bklas IN s_bklas "Valuation Class

WITH matnr IN s_matnr "material number

WITH aksaldo = p_aksal "current period

WITH vmsaldo = p_vmsal "previous period

WITH vjsaldo = p_vjsal "previous year

WITH summen = p_summen "totals only

WITH negativ = p_negat "Negative stocks

WITH nullb = p_nullb "materials with 0 stock

WITH keinzel = p_keinz "valuation area

WITH pruef = p_pruef "extended chack

WITH matlines = p_matlin "display indi mat lines

WITH alv_def = p_alv_de "layout

EXPORTING LIST TO MEMORY AND RETURN.

Former Member
0 Kudos

Hello Max,

In FM JOB_OPEN the jobname is missing.. it seems that the variable VA_JOBNAME is not populated. How can we populate this value?

Appreciate your reply. Thanks

0 Kudos

Hi

Excuse me, I'm very sorry.

It's only the job name so u can move the job name you want or like:

VA_JOBNAME = 'MY_JOB'.

Only rule is the name has to have a length of 32 char

Max