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

Help needed

Former Member
0 Likes
494

Hi Experts,

I need your help.

Just check out this piece of code.

FORM delete_files .

DATA: l_files TYPE rs37a-line,

l_cmd TYPE rs37a-line,

it_list LIKE STANDARD TABLE OF l_cmd WITH HEADER LINE.

CONCATENATE p_source '*.xls' INTO l_files.

CONCATENATE 'rm -f' l_files INTO l_cmd SEPARATED BY space.

REFRESH it_list.

CALL 'SYSTEM' ID 'COMMAND' FIELD l_cmd

ID 'TAB' FIELD it_list-sys.

IF sy-subrc = 0.

MESSAGE s018(zz).

ELSE.

MESSAGE e019(zz).

ENDIF.

ENDFORM. " DELETE_FILES

Here I am deleting all files of a directory at once ,how do I delete one file at a time .

3 REPLIES 3
Read only

Former Member
0 Likes
467

Hi,

just a guess, try this

CALL 'SYSTEM' ID 'COMMAND' FIELD l_cmd

ID 'FLD' FIELD it_list-filename. <----- TAB changed to FLD

Edited by: Chandrasekhar Jagarlamudi on Jun 19, 2008 11:16 PM

Read only

former_member156446
Active Contributor
0 Likes
467

Hi there

'*.xls' need to be replaced with the one single file name you want to delete..

CONCATENATE p_source 'file1.xls' INTO l_files.

or change the decelration

it_list LIKE STANDARD TABLE OF l_cmd WITH HEADER LINE.

to

it_list LIKE line OF l_cmd.

Edited by: Jay Sadaram on Jun 19, 2008 10:48 AM

Read only

JanStallkamp
Advisor
Advisor
0 Likes
467

Hi.

Please have a look into the [rules of engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] of all SDN forums. Threads not following the rules will be deleted. See Michael Schwandt's [blog about strict moderation|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/10047] [original link is broken] [original link is broken] [original link is broken]; for details. As these strict moderation policy is quite new I will not delete this thread but lock it.

Best regards,

Jan Stallkamp