Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

delete file form SAP application server

Former Member
9,428

Hi all,

I need some help on deleting files from SAP application server.

what i want to do is.

  • upload the file from the server to a internal table

  • then do the sales order creation using a BAPI

  • then transfer the file to another folder.

I know how to upload and do the SO creation. only problem is with deleting the file.

I know how to write it in another location.

can any of u guys help me out on this.

thanks in ADV

nafran

1 ACCEPTED SOLUTION
Read only

Former Member
5,259

Hi,

use process type 'os command' and you can delete the file.

OR

Try DELETE DATASET <dataset name> .

or use FM EPS_DELETE_FILE

ie;

You can use DELETE DATASET with target path.

Use statement

delete dataset '\tmp\file.txt'.

\tmp\file.txt is the file path on application server which you want to delete.

hope this helps.

Regards,

Raj.

6 REPLIES 6
Read only

Former Member
0 Likes
5,259

You'll need to set up an Operating System command in txn SM69.

And execute this in your program using func mod SXPG_EXECUTE

Read only

0 Likes
5,259

@Phil Rix:

Sorry, but you do not need to execute an OS command to delete a file on AppServer.

To delete a file localed on AppServer use ABAP statement


DELETE DATASET...

Read only

0 Likes
5,259

Your quite right Mike, using DELETE is far simpler

Read only

Former Member
5,260

Hi,

use process type 'os command' and you can delete the file.

OR

Try DELETE DATASET <dataset name> .

or use FM EPS_DELETE_FILE

ie;

You can use DELETE DATASET with target path.

Use statement

delete dataset '\tmp\file.txt'.

\tmp\file.txt is the file path on application server which you want to delete.

hope this helps.

Regards,

Raj.

Read only

Former Member
0 Likes
5,259

For Writing a file or reading a file from the Appl server, You need to use the statement: "Open Data Set" / "TRANSFER - Writing to a File" / "DELETE - Delete a file ";

Check out the help on these statements

Hope this helps you

Regards

Shiva

Read only

Former Member
0 Likes
5,259

As you need to copy the file from one folder to another, you can use command MOVE <path1> <path2>.