Hi Experts,
I have created a report which exports a CSV file onto the application server using the DATASET funda.
The problem is I am running a background job every hour for this report and they all are getting cancelled.
The weird thing is when I run the report in foreground it runs fine deleting and recreating the file.
But the same not working in background job.
The funny thing is right after I run the report in foreground, the next background job runs successfully. and right after that the next background job is cancelled again.
I have posted my code below.
Pls help where I am making a mistake.
+++++++++++++++++++++++++++++++++++++++++++++
LOOP AT it_csv.
CLEAR xout.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE it_csv TO <fs>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF sy-index = 1.
xout = <fs>.
ELSE.
CONCATENATE xout <fs> INTO xout SEPARATED BY ';'.
ENDIF.
ENDDO.
APPEND xout TO iout.
ENDLOOP.
DATA : lv_fname TYPE string. "LIKE rlgrap-filename.
lv_fname = 'G:\GoogleDriveSAPData\SAP_PROD_GOOGLE_Data\Batch_Details.csv'. " Provide the file path & file name with CSV extention
DELETE DATASET lv_fname.
OPEN DATASET lv_fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT iout INTO xout.
TRANSFER xout TO lv_fname.
CLEAR xout.
ENDLOOP.
CLOSE DATASET lv_fname.
+++++++++++++++++++++++++++++++++++++++++++++++