12-24-2014 5:24 PM
Hi
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?
Thanks
Praveen
12-24-2014 6:09 PM
Hi Praveen ,
It is not possible to upload data from frontend while executing the program in background .
If you want to access data in background , you need to have the file in application server first.
Save your file on application server using tcode CG3Z and then use that file.
Thanks ,
Saddam
12-24-2014 6:09 PM
Hi Praveen ,
It is not possible to upload data from frontend while executing the program in background .
If you want to access data in background , you need to have the file in application server first.
Save your file on application server using tcode CG3Z and then use that file.
Thanks ,
Saddam
12-25-2014 4:29 AM
HI Saddam
Is it possible that the file is uploaded on the execution screen manually and then it goes to background execution
12-25-2014 4:43 AM
if you want to upload file manually and then to background. you can break up program in two. first will get the input file manully. and then pass uploaded data to second program and run in background by using JOB_OPEN, JOB_CLOSE fm's.
Or
you can use a separate FM to run in background after getting file input manually.
CALL FUNCTION func IN BACKGROUND TASK
12-25-2014 4:51 AM
I tried that but got stuck on how to pass the data from one program to another.
I tried this--
SUBMIT "program name"WITH pi_table = lt_data
VIA JOB lv_jobname NUMBER lv_jobcount
TO SAP-SPOOL WITHOUT SPOOL DYNPRO AND RETURN.
where pi_table is a input parmeter in the second program. But I think this is not the way. Can you please help me the code?
Thanks
12-25-2014 5:07 AM
Is pi_table a parameter or selection options on selection screen of the second program? It is your data itab, right?
So if want pass this itab to the second program, maybe need 'Export to shared memory', in your second program 'import shared memory' which is running in background job.
regards,
Archer
12-26-2014 7:31 PM
Hi Archer
I was doubtful about it but after your suggestion I used this method.
1st program
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'
2nd Program
IMPORT lt_data FROM MEMORY ID 'ABCD'.
here I used my data from program 1 to be executed in background