Skip to Content

How to execute a report program in background based on input parameter?

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Dec 24, 2014 at 06: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

    Add comment
    10|10000 characters needed characters exceeded

    • 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