How to execute a report program in background based on input parameter?
I have report program with some input parameters.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS : p_rad1 RADIOBUTTON GROUP rb1 USER-COMMAND rad DEFAULT 'X'.
PARAMETERS : p_rad2 RADIOBUTTON GROUP rb1. "selected for background processing
PARAMETERS: p_file TYPE string.
PARAMETERS: p_field1 TYPE c LENGTH 1 DEFAULT 'A'.
PARAMETERS: category(10) AS LISTBOX VISIBLE LENGTH 30 DEFAULT '50000067'.
PARAMETERS: p_field2 TYPE c LENGTH 1 DEFAULT 'D'.
PARAMETERS: p_date TYPE sy-datum DEFAULT sy-datum.
PARAMETERS: p_chbx AS CHECKBOX USER-COMMAND flag DEFAULT ' '.
SELECTION-SCREEN END OF BLOCK b1.
<<< my logic to read the data and process it >>>
I have a "p_file" to upload data in flat file format before execution. And on selection of the radio button p_rad2 I need to execute this program in background and otherwise it is to be executed manually.
I tried using JOB_OPEN, JOB_SUBMIT, JOB_CLOSE but got stuck somewhere. Please can anybody guide me in detail on how to do this by any method?
Praveen Dwivedi replied
I was doubtful about it but after your suggestion I used this method.
CALL FUNCTION 'JOB_OPEN'
EXPORT lt_data TO MEMORY ID 'ABCD'.
SUBMIT "program2_name" VIA JOB lv_jobname NUMBER lv_jobcount TO SAP-SPOOL WITHOUT SPOOL DYNPRO AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
IMPORT lt_data FROM MEMORY ID 'ABCD'.
here I used my data from program 1 to be executed in background