Application Development 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: 

Creating folder in background

Former Member
0 Kudos

Hi,

I can't find a way of creating a folder in the background.

the class CL_GUI_FRONTEND_SERVICES only works in the foreground.

Thanks,

Naama

1 ACCEPTED SOLUTION

Sougata
Active Contributor
0 Kudos

Hello Naama,

As the class name suggests CL_GUI_FRONTEND_SERVICES so its methods will only succeed if the frontend (gui) is available otherwise not.

If you are trying to create a windows directory on your local machine it must be run on foreground so that SAPGUI (frontend) is available when its run. There is no other way to achieve this as it does not make any sense to do so anyway as a background process if you think about it.

Cheers,

Sougata.

4 REPLIES 4

Sougata
Active Contributor
0 Kudos

Hello Naama,

As the class name suggests CL_GUI_FRONTEND_SERVICES so its methods will only succeed if the frontend (gui) is available otherwise not.

If you are trying to create a windows directory on your local machine it must be run on foreground so that SAPGUI (frontend) is available when its run. There is no other way to achieve this as it does not make any sense to do so anyway as a background process if you think about it.

Cheers,

Sougata.

Former Member
0 Kudos

Hi,

I need to check if a directory exits and create a directory,

in the server.

Naama

Sougata
Active Contributor
0 Kudos

I understand you want to check and then create a directory at the Application Server and not create a Windows directory.

You can do this by calling an external command (via a function module) configured in transaction SM69. Use FM SXPG_COMMAND_EXECUTE.

To check if the direcory already exists, you can use FM EPS_GET_DIRECTORY_LISTING. Then to create it, first in SM69 you create a command (or better ask the Basis team to do it for you if you are not sure) like mkdir <dir> if you are running Windows OS or /bin/sh/ mkdir <dir> if you are running UNIX where <dir> is the new directory name that you want to create. After this step, from your program call function SXPG_COMMAND_EXECUTE with the Import Parameter COMMANDNAME = the name of new script created in SM69 in the first step as above.

Hope this helps,

Cheers,

Sougata.

Clemenss
Active Contributor
0 Kudos

Hi General,

there is a widespread knowledge gap about SAP: SAP R/3 and later is a so-called client-server-system. That means, SAP system is running on a server (with access to server directories). Files on the server are generally read and written by ABAP DATASET´commands.

CL_GUI_FRONTEND_SERVICES has the GUI in it's name. GUI means Graphical User Interface. This is the SAPGUI running on your local PC (client). The GUI has access to your local PC files, so has CL_GUI_FRONTEND_SERVICES.

All background processes are running on the SAP server without any access to any PC. So there is no active GUI that can communicate to CL_GUI_FRONTEND_SERVICES.

If your SAP system runs on windows server, your PC may have access to the SAP server directories. But still the server access will go with , OPEN, READ DATASET, TRANSFER TO.

Those are technical restrictions you can not ignore,

Regards,

Clemens