Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
I had a colleague recently ask me for a work around to an issue he was constantly battling.  You can read about this solution to dynamic Op sys commands BI Process Chains with Dynamic System Command.  As a result I was turned on to a not so well known (by me anyway) tcode SM69.  This transaction code allows you to create / manage External Operation System Commands.  Yesterday I was asked to build a solution that required the manipulation of files and folders programmatically and schedule this job to run in the background.  As most of you know, because you’ve probably done it yourselves…I was able to add, delete and move files without much trouble.  But folders…how can this be done?  I looked for function modules, class methods, SDN posts.  NOTHING solved this dilemma.  As a matter of fact, there are countless posts on the ABAP forums requesting a solution to this problem.  Incredibly none that I found are answered.  SOOO here’s how you can do it. 

Launch SM69 and create a new command.  The create Icon is the standard page with the bent down corner.

Create Directory Command

Remove Directory Command

 

Now that the commands are available, you can call them using the SAP delivered FM  SXPG_COMMAND_EXECUTE

 

I wrapped the call to this function module in two static methods of a class and am importing a parameter of type string that holds the UNC path of the folder to be created or removed.  Here is an example of my method call and the contents of the method.

Method contents

Pretty simple!