@bingshui-hl @LIM_ENG_KEONG @LevKushnir
Hello Bingshui, Lim and Lev,
it is definitely a question of the version of the SAP_BASIS component.
I analyzed the ABAP code and I found the difference in the method FILE_SAVE_DIALOG from the class CL_GUI_FRONTEND_SERVICES, which is called from the function module XML_EXPORT_DIALOG from the method DOWNLOAD from the class CL_SALV_EXPORT_XML_DIALOG.
Here the differentiating ABAP code:
call method IS_SCRIPTING_ACTIVE receiving result = rt_value EXCEPTIONS others = 1.
if rt_value = 1.
* check the registry key
call method cl_gui_frontend_services=>registry_get_dword_value
exporting root = cl_gui_frontend_services=>HKEY_CURRENT_USER
key = 'Software\SAP\SAPGUI Front\SAP Frontend Server\Scripting'
value = 'ShowNativeWinDlgs'
importing reg_value = RCCU
exceptions
others = 1.
call method cl_gui_frontend_services=>registry_get_dword_value
exporting root = cl_gui_frontend_services=>HKEY_LOCAL_MACHINE
key = 'Software\SAP\SAPGUI Front\SAP Frontend Server\Scripting'
value = 'ShowNativeWinDlgs'
importing reg_value = RCLM
exceptions
others = 1.
call method cl_gui_cfw=>flush.
if RCCU = 0 or ( RCCU ne 1 and RCLM ne 1 ) .
RT_VALUE = 'X'.
call FUNCTION 'GUI_FILE_SAVE_DIALOG'
exporting
WINDOW_TITLE = WINDOW_TITLE
DEFAULT_EXTENSION = DEFAULT_EXTENSION
DEFAULT_FILE_NAME = DEFAULT_FILE_NAME
WITH_ENCODING = WITH_ENCODING
INITIAL_DIRECTORY = INITIAL_DIRECTORY
FILE_FILTER = FILTER
importing
FULLPATH = FULLPATH
FILE_ENCODING = FILE_ENCODING
USER_ACTION = USER_ACTION.
endif.
endif.
As you can see at first a method is called which detects is scripting is active or not. If it is active it call the function module GUI_FILE_SAVE_DIALOG instead of FileSaveDialog of the SAPInfo Control module, which calls the native Windows dialog. This works independently from the SAP GUI for Windows version and from its settings.
Bingshui and Lim, which version of the SAP_BASIS package do you use?
You can detect the version as I described above.
Now we know the reason and we see that the behavior of the SAP GUI for Windows it is also dependent from the SAP backend, in this case from the SAP_BASIS component.
Best regards
Stefan
Addition
01.05.2021
The function Module XML_EXPORT_DIALOG contains an input parameter I_APPLICATION, if a related application can be detected it will be opened after the download. The method GET_PC_APPLICATION of the class CL_SALV_GUI_DATA_PUBLISHER do that.
method get_pc_application.
check cl_salv_gui_data_publisher=>c_gui_type_windows EQ gui_type.
if platform eq cl_gui_frontend_services=>platform_mac
or platform eq cl_gui_frontend_services=>platform_macosx
or platform eq cl_gui_frontend_services=>platform_linux. "Linux
exit.
endif.
if frontend eq cl_alv_bds=>mc_excel_frontend
or frontend eq cl_alv_bds=>mc_xlsx_frontend
or frontend eq cl_alv_bds=>mc_mhtml_frontend.
data excel_file type string.
call method cl_gui_frontend_services=>registry_get_value
exporting
root = cl_gui_frontend_services=>hkey_classes_root
key = 'ExcelWorksheet\protocol\StdFileEditing\server'
value = ''
importing
reg_value = excel_file.
endif.
value = excel_file.
endmethod.
As we can see it detects, in case of Excel download, via a registry entry the Excel application and the FM XML_EXPORT_DIALOG starts the application via cl_gui_frontend_services=>execute.
What does this mean: An automation workflow that downloads Excel data from an SAP back-end system behaves differently in dependency if an Excel application is installed or not.
Addition
09.07.2021
Today I found an SAP OSS Note 2038061 - File open dialogs cannot be handled in SAP GUI Scripting, which describes this point. The solution is an update of the SAP_BASIS component.