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

SUBMIT

Former Member
0 Likes
705

Hi All,

i have one requirement i.e.

while executing one program, in the middle of its execution i want to submit one more report that one has selection screen and i want to execute and return to the main program.

for this i can use SUBMIT prgname VIA SELECTION SCREEEN using SLECTION_SET 'Variant' and return.

but it will execute the program in the foreground now my requirement is i want to submit that prg in the back ground and it should return to the prg from where it called for this what i have to do....

5 REPLIES 5
Read only

Former Member
0 Likes
668

use the submit statement between the function modules..

call function job_open

submit..

call function job_close..

Read only

0 Likes
668

in my code i have written like this but it is not working wht might be the reason

DATA:
    lw_name LIKE tbtcjob-jobname .

  lw_name = 'USBANK_INVOICES'.


  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      jobname          = lw_name
    IMPORTING
      jobcount         = w_jobcount
    EXCEPTIONS
      cant_create_job  = 1
      invalid_job_data = 2
      jobname_missing  = 3
      OTHERS           = 4.


  IF sy-subrc = 0.
    SUBMIT rfbibl00
           VIA JOB lw_name NUMBER w_jobcount
           USING SELECTION-SET 'USBANK_INV'
           AND RETURN.
    IF sy-subrc EQ 0.
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount             = w_jobcount
          jobname              = lw_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.
    ENDIF.
  ENDIF.

Read only

0 Likes
668

in your program in submit statement you didnt specify the jobname

SUBMIT zmio_manu_dmd_fcst_unit_extr WITH SELECTION-TABLE it_seltab2 VIA JOB jobname NUMBER jobnum AND RETURN.

IF sy-subrc NE 0.

WRITE: /5 'Error when submitting', jobname.

ENDIF.

Read only

Former Member
0 Likes
668

DATA: number TYPE tbtcjob-jobcount,

name TYPE tbtcjob-jobname VALUE 'JOB_TEST',

print_parameters TYPE pri_params.

...

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 submitable 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.

Read only

Former Member
0 Likes
668

Hi,

DATA: gv_jobcount TYPE tbtcjob-jobcount,
          gv_jobname TYPE tbtcjob-jobname,
          gs_spool TYPE pri_params.


FORM background_job .

  gs_spool-pdest = 'SPOOL'.
  gv_jobname = 'ZZ'.

  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
*   DELANFREP              = ' '
*   JOBGROUP               = ' '
      jobname                = 'ZE016'
*   SDLSTRTDT              = NO_DATE
*   SDLSTRTTM              = NO_TIME
*   JOBCLASS               =
   IMPORTING
     jobcount               = gv_jobcount
* CHANGING
*   RET                    =
 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.

  CALL FUNCTION 'JOB_SUBMIT'
    EXPORTING
*   ARCPARAMS                        =
      authcknam                      = sy-uname
   commandname                       = ' '
   operatingsystem                   = ' '
   extpgm_name                       = ' '
   extpgm_param                      = ' '
   extpgm_set_trace_on               = ' '
   extpgm_stderr_in_joblog           = 'X'
   extpgm_stdout_in_joblog           = 'X'
   extpgm_system                     = ' '
   extpgm_rfcdest                    = ' '
   extpgm_wait_for_termination       = 'X'
      jobcount                       = gv_jobcount
      jobname                        = gv_jobname
   language                          = sy-langu
   priparams                         = gs_spool
     report                          = sy-repid
     variant                         = p_var1
* IMPORTING
*   STEP_NUMBER                      =
 EXCEPTIONS
   bad_priparams                     = 1
   bad_xpgflags                      = 2
   invalid_jobdata                   = 3
   jobname_missing                   = 4
   job_notex                         = 5
   job_submit_failed                 = 6
   lock_failed                       = 7
   program_missing                   = 8
   prog_abap_and_extpg_set           = 9
   OTHERS                            = 10
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  gs_bckg_entrylog-jobname = gv_jobname.
  gs_bckg_entrylog-jobcount = gv_jobcount.
  gs_bckg_entrylog-report = sy-repid.
  gs_bckg_entrylog-variant = p_var1.

  IF sy-msgty EQ 'E'.
    gs_bckg_entrylog-ricon = icon_led_red.
  ELSEIF sy-msgty EQ 'S'.
    gs_bckg_entrylog-ricon = icon_led_green.
  ELSEIF sy-msgty EQ 'W'.
    gs_bckg_entrylog-ricon = icon_led_yellow.
  ELSE.
    gs_bckg_entrylog-ricon = icon_led_yellow.
  ENDIF.

  APPEND gs_bckg_entrylog TO gt_bckg_entrylog.
  CLEAR gs_bckg_entrylog.

  PERFORM bckg_log.

  CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
   at_opmode                         = ' '
   at_opmode_periodic                = ' '
   calendar_id                       = ' '
   event_id                          = ' '
   event_param                       = ' '
   event_periodic                    = ' '
      jobcount                       = gv_jobcount
      jobname                        = 'ZZ'
*   LASTSTRTDT                       = NO_DATE
*   LASTSTRTTM                       = NO_TIME
   prddays                           = 0
   prdhours                          = 0
   prdmins                           = 15
   prdmonths                         = 0
   prdweeks                          = 0
   predjob_checkstat                 = ' '
   pred_jobcount                     = ' '
   pred_jobname                      = ' '
*   SDLSTRTDT                        = NO_DATE
*   SDLSTRTTM                        = NO_TIME
*   STARTDATE_RESTRICTION            = BTC_PROCESS_ALWAYS
   strtimmed                         = 'X'
   targetsystem                      = ' '
   start_on_workday_not_before       = sy-datum
   start_on_workday_nr               = 0
   workday_count_direction           = 0
*   RECIPIENT_OBJ                    =
   targetserver                      = ' '
   dont_release                      = ' '
   targetgroup                       = ' '
*   DIRECT_START                     =
* IMPORTING
*   job_was_released                 = gv_released
* CHANGING
*   RET                              =
 EXCEPTIONS
   cant_start_immediate              = 1
   invalid_startdate                 = 2
   jobname_missing                   = 3
   job_close_failed                  = 4
   job_nosteps                       = 5
   job_notex                         = 6
   lock_failed                       = 7
   invalid_target                    = 8
   OTHERS                            = 9
            .
  IF sy-subrc <> 0.
*    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.



ENDFORM.                    " background_job

Hope this will help you,

Plz reward if useful.

Thanks,

Dhanashri.

Edited by: Dhanashri Pawar on Jun 18, 2008 12:18 PM