‎2009 Jun 10 3:17 PM
hi everybody
does delete dataset command work in background mode?
wen i execute my program in foreground, the dataset is deleted but when it is run in background mode, its not deleted
‎2009 Jun 10 3:27 PM
I am using delete dataset command and able to delete dataset using both foreground and background.
Please refer below code for your reference.
open dataset p_file for output in text mode
encoding default.
delete dataset p_file.
close dataset p_file.
Thank you
Seshu
‎2009 Jun 10 3:37 PM
Hi,
It will delete the dataset in the Background too. Before using this statement the check the file exists in AL11. and even check after the statement exeution.
‎2009 Jun 10 3:44 PM
Hi Anjali,
Deleting a File
To delete a file from the application server, use the DELETE DATASET statement:
Syntax
DELETE DATASET <dsn>.
This statement deletes the file <dsn>. The naming convention is described in the section Opening a File.
If the system deletes the file <dsn> successfully, SY-SUBRC is set to 0. If not, it is set to 4.
The followinng code will make it clear that it works both foreground and background
DATA FILENAME(60) VALUE 'FILETEST'.
OPEN DATASET FILENAME FOR OUTPUT.
OPEN DATASET FILENAME FOR INPUT.
IF SY-SUBRC = 0.
WRITE / 'File found'.
ELSE.
WRITE / 'File not found'.
ENDIF.
DELETE DATASET FILENAME.
OPEN DATASET FILENAME FOR INPUT.
IF SY-SUBRC = 0.
WRITE / 'File found'.
ELSE.
WRITE / 'File not found'.
ENDIF.
The output appears as follows:
File found
File not foundP.S Syntax source is from help.sap.com
Revert for further clarification.
Thanks and Regards
Srikanth.P
‎2009 Jun 10 6:05 PM
Make sure you are closing dataset. Also try WAIT after CLOSE DATASET command.
Check sy-subrc code. Do F1 on DELETE DATASET Command to understand sy-subrc return values.
‎2009 Jun 12 8:20 AM