‎2008 Jul 09 2:05 PM
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!
‎2008 Jul 09 2:12 PM
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
‎2008 Jul 09 2:12 PM
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
‎2008 Jul 09 2:26 PM
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
‎2008 Jul 09 2:28 PM
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.
‎2008 Jul 09 2:43 PM
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
‎2008 Jul 09 2:48 PM
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