Mac OS X environment variables and SAP GUI for Java
Problem with SAP GUI for Java
Few days ago I came across an issue, that I couldn’t open MS Office files via SAP GUI for Java for Mac OS X. This behavior I caught in SCASE and SCASEPS transactions, but maybe it also applies to other transactions (although I wasn’t successful to get the same error in SBWP speaking of attachments).
So, returning to SCASE and SCASEPS transactions – when I tried to open MS Word file, attached to Case, I received error message (SBDV 071) “No temporary directory available for temporary storage”.
Firstly, I thought that the trouble is in SAP GUI Preferences for Applications, where Download and Upload directories are defined. But any changes is these settings did no effect to the problem. Seems, that this setting has no impact on my issue.
So, secondly, I started debugging source code to get the place, where I receive message mentioned above (SBDV 071). I found that the problem was in results of CL_GUI_FRONTEND_SERVICES=>CL_GUI_FRONTEND_SERVICES. It tried to get the value for parameter TEMP and it returned “space”. Looking through SAP manuals (Link), I discovered, that requested by system variable would receive “space” value only if Operating System didn’t have such variable.
My third step was to look through MAC OS X 10.11 environment variables. To do it one needs to start terminal and use “env” command to list defined variables.
I found that there was no TEMP variable, although there was TMPDIR variable, which is the same, as it seems to me. After discovery I decided to add TEMP variable to my Mac OS X configuration and see the results. To skip few details I need to say that the results were positive – I was able to open MS Word document from SAP as it was downloaded in background to specified folder and opened by MS Word for Mac without any additions clicks from me.
How To Set Environment Variables in Mac OS X
As many people are using different versions of Mac OS X, I’m writing down information for 10.6 – 10.11 versions.
OS X 10.6, 10.7
To set an environment variable, enter the following command
- defaults write ~/.MacOSX/environment variable “value”
To find out which environment variables have been set, enter the following command:
- defaults read ~/.MacOSX/environment
OS X 10.8, 10.9, 10.10
To set an environment variable, enter the following command:
- launchctl setenv variable “value”
To find out if an environment variable is set, use the following command:
- launchctl getenv variable
To clear an environment variable, use the following command:
- launchctl unsetenv variable
did you find any documentation saying that these transactions need TEMP set in order to make opening downloaded files work?
Neither on Linux nor on OS X, TEMP can be expected to be set. To request a temp directory, CL_GUI_FRONTEND_SERVICES provides GET_TEMP_DIRECTORY() and the SAP GUIs can return an existing path.
To me, it looks like it should not be the user's task to make this work, but the ABAP code should be changed to make this work out of the box. You might want to consider opening a support message requesting to fix this in the ABAP code of those transactions.
Thanks for Your reply!
Nope, I haven't found any docs on this matter. But I have found that in code, which is executed, the method GET_TEMP_DIRECTORY of class CL_SRM_SP_BDV is called. Inside it there is a code for case WHEN srmif_gui_type_java:
CALL METHOD cl_gui_frontend_services=>environment_get_variable
variable = 'TEMP'
value = l_dir_str
OTHERS = 99.
So it's always TEMP for Java GUI. Though my colleague told me that there is no such problem in Windows with Java GUI.
Maybe it's really a good idea to create a support message.
Many thanks for pointing to the related source code.
On Windows, there is typically TEMP set, this is why it works with SAP GUI for Java on Windows.
This ABAP code definately should be changed.
Let me know if you are going to create a support message, otherwise I will try to address this internally.
Sorry for a late reply.
I passed the solution to my colleagues and they decided not to create a support message. So I would like to ask You to address this issue internally.
Thank You in advance!
I have created an internal incident for this.
You won't be able to see it, but as a reference, the number is 1580222742.
It took quite long, but now my internal incident has been handled.
With the ABAP code change part of
setting the environment variable TEMP is not longer required to be set.