Background Jobs To List Dir Move Files

The client thought is to have a background job setup, which will list the files in the directory, then the program will open one file at a time and process it, and in the last step, move the file to another fixed folder on the Win Server?

How would it be possible to run an external command, and if this is the case, how to write it (using SM69)?

This should give some ideas:

Coding:

call 'C_DIR_READ_START' id 'DIR'    field f1
                        id 'FILE'   field f2
                        id 'ERRNO'  field f3
                        id 'ERRMSG' field f4.

................

do.

    call 'C_DIR_READ_NEXT'

       id 'TYPE'   field f5
       id 'NAME'   field f6
       id 'LEN'    field f7
       id 'OWNER'  field f8
       id 'MTIME'  field f9
       id 'MODE'   field f10
       id 'ERRNO'  field f3
       id 'ERRMSG' field f4.

    case sy-subrc.

      when 0.

*     process filename

.....

enddo.

Coding:

call 'C_DIR_READ_FINISH'

  id 'ERRNO'  field f3
  id 'ERRMSG' field f4.

This gets you the file list.

Then execute an operating system command to move the files.

Coding:

call 'SYSTEM' id 'COMMAND'

  field lf_command...................

*-- End of Program

ABAP Tips

See Also
Sending Mutiple Excel Sheets As An Attachment

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Main Index
SAP Basis, ABAP Programming and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.