cancel
Showing results for 
Search instead for 
Did you mean: 

SUBMIT and RETURN not working when run in background

kjyothiraditya
Participant

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

Accepted Solutions (1)

Accepted Solutions (1)

Sandra_Rossi
Active Contributor

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.

kjyothiraditya
Participant
0 Kudos

Hi Sandra,

Thanks for your reply. There is no error message in JOB_OPEN, SUBMIT and CLOSE, also sy-subrc is 0. Could it be that the job was not started?

Regards,

Aditya

Sandra_Rossi
Active Contributor
0 Kudos

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.

Answers (2)

Answers (2)

horst_keller
Product and Topic Expert
Product and Topic Expert

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

Especially, see step 1 ...

roberto_forti
Contributor

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,

kjyothiraditya
Participant

Hi Roberto,

thanks for your reply. Apparently, I do not want to run the 2nd program in the foreground but in background. Using the above it is taking me to Selection screen of 2nd program where i could see a button to schedule in background.

Once gain thanks for the reply.

Regards,

Aditya

roberto_forti
Contributor

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,