Skip to Content

SUBMIT and RETURN not working when run in background

Hi Experts,

I am trying to schedule a report B via BG job from report A using SUBMIT AND RETURN along with using FM JOB_OPEN and JOB_CLOSE. The program runs fine in foreground, but when we try to schedule report B as BG job from program A, it is not getting executed. i have debugged and found that the program is not going to START-OF-SELECTION but validating selection screen events.

My submit statement looks like below:

SUBMIT REPORT2 WITH paramters_in_B = parameters_in_A

WITH selectoptions_in_B IN selectoptions_in_B

USER 'XXXX'

VIA JOB 'JOBNAME'

NUMBER 'XXXX' AND RETURN

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 14 at 06:42 AM

    Yes, at the time of the SUBMIT (my remark is about before JOB_CLOSE is executed, i.e. not during the background job, although it's executed at that moment too), it always go through the selection-screen validation : if there's an error and the submission runs in dialog mode, then the SUBMIT VIA JOB displays the selection screen along with the error message (yes, during the job submission). Anyway, your question is more about the job NOT being launched.

    BUT did you check the return codes of JOB_OPEN, SUBMIT and CLOSE, and is the job really NOT scheduled in SM37 -> don't forget to also display the jobs with a missing start condition, i.e. planned/preliminary status)?

    If everything is fine, then check the SAP notes, and if you find nothing then open a ticket at SAP support.

    Add comment
    10|10000 characters needed characters exceeded

    • Sandra Rossi jyothir aditya k

      If there's no error, then it should work. As I said, check in SM37 (if you closed the job without any start condition then it has a status with value planned/preliminary, you may still see it in SM37); otherwise check SAP notes, if none can be applied then open a ticket.

  • Apr 14 at 10:04 AM

    In fact, the füll behavior is explained here:

    https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abapsubmit_via_job.htm

    Especially, see step 1 ...

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 13 at 10:47 PM

    Hi Jyothir,

    Also implement the below code in your submit statement regarding SAP link.

    USING SELECTION-SCREEN dynnr

    https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/abapsubmit_interface.htm

    Regards,

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Jyothir,

      Check if the USER has authorization - object S_BTCH_NAM.

      "USING SELECTION-SCREEN dynnr" works fine considering yours submit via JOB (background).

      Below SAP explain.

      Addition 1

      ... USING SELECTION-SCREEN dynnr

      Effect

      This addition defines which selection screen is called. dynnr is a data object that must contain the dynpro number of a selection screen defined in the called program when the statement SUBMIT is executed.

      • If the addition USING SELECTION-SCREEN is omitted or the dynpro number 1000 is entered, the standard selection screen is called. If no standard selection screen is defined in the called program, no selection screen is called.
      • If a dynpro number other than 1000 is entered in the addition USING SELECTION-SCREEN, the corresponding standalone selection screen is called. If no selection screen with this dynpro number is defined in the called program, a non-handleable exception is raised.

      Addition 2

      ... VIA SELECTION-SCREEN

      Effect

      If this addition is specified, the selection screen is "displayed" on the screen. Otherwise, background selection screen processing takes place. In background selection screen processing, the selection screen events are raised without the selection screen being displayed.

      Regards,