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

sumbit wait until

Former Member
0 Likes
1,401

I am using JOB_OPEN , SUBMIT and JOB_CLOSE for a report1 to create a spool in background processing.

After the JOB_CLOSE i am calling a fm for display the spool list.

My problem is after submitting the report1 in background how to hold the fm unless the background process for report1 is complete .

My question how to use submit statement wait for submit report1 is finished and then only call

call function 'LIST_FROM_MEMORY'.

call function 'JOB_OPEN'

exporting

jobname = v_jobname

importing

jobcount = v_jobcount

exceptions

cant_create_job = 01

invalid_job_data = 02

jobname_missing = 03

others = 99.

submit report1

via job v_jobname

number v_jobcount

to sap-spool without spool dynpro

spool parameters wa_params

and return.

call function 'JOB_CLOSE'

exporting

jobcount = v_jobcount

jobname = v_jobname

strtimmed = 'X'

importing

job_was_released = v_job_released

exceptions

invalid_startdate = 01

jobname_missing = 02

job_close_failed = 03

job_nosteps = 04

job_notex = 05

lock_failed = 06

others = 99.

call function 'LIST_FROM_MEMORY'

tables

listobject = ilist..

regards,

anuj

2 REPLIES 2
Read only

former_member194669
Active Contributor
0 Likes
591

before calling LIST_FROM_MEMORY you need to something this way


  do.
    call function 'SHOW_JOBSTATE'
      exporting
        jobcount         = p_jobc
        jobname          = p_jobn
      importing
        aborted          = v_aborted
        finished         = v_finished
        ready            = v_ready
        running          = v_running
        scheduled        = v_scheduled
      exceptions
        jobcount_missing = 1
        jobname_missing  = 2
        job_notex        = 3
        others           = 4.
    if v_aborted eq 'X'.
      exit.
    endif.
    if v_finished eq 'X'.
      select single * from tbtcp into wa_tbtcp1
                 where jobname eq p_jobn
                   and jobcount eq p_jobc.

      if sy-subrc eq 0.
        move wa_tbtcp1-listident to p_spono.
      endif.
      exit.
    endif.
    if v_count le 60.
      call function 'ENQUE_SLEEP'
        exporting
          seconds = 90.
      v_count = v_count + 1.
    endif.
  enddo.

a®

Read only

Former Member
0 Likes
591

thanks all.