SAP Save As Dialogue won't respond to UIPath

HI @StefanSchnell

Any ideas, why @bingshui-hl is still getting Windows Popup instead of SAP popup?

Thanks, Lev

@LevKushnir

Hello Lev,
not really.

I tried it with the oldest SAP release from my archive 7.40 PL0 to ensure that this is not a question of the ALV grid release. But it works as in your video.

The TAC SE16N is in my case part of the package WUSL which is part of the component SAP_FIN. In my case it is this:

image

What release of SAP_FIN do you use? What release of SAP_FIN do you use @bingshui-hl?

I remember dark a discussion in the SAP forum a long time ago about the change from Windows dialog boxes to SAP dialog boxes in case of scripting in 2014 with SAP GUI for Windows 7.30 PL8. And as far as I can remember correct the using of SAP dialog boxes is also dependent from the backend version. Maybe you should take a look at it. That would be my only suggestion.

You can find the version in the menu System > Status… and the press the button with the magnifier glas.
image

Let us know your result.

Best regards
Stefan

hello Stefan
Attached is my SAP_FIN.

About the discuss in SAP forum, it’s mentioned by Lev and I have tried out with checkbox and without, neither work.

1 Like

@bingshui-hl

Hello Bingshui,
your component is up to date.

Please try the following steps:

  1. Set your user settings to ALV Grid display
    image
  2. Open TAC SE16
  3. Input table name TFDIR (or any other)
  4. Press F7
  5. Press F8
    Now you should see something like this:
    image
  6. Open in the Customize Local Layout the Script Recording and Playback item
    image
  7. Start the recording by pressing the red bubble.

    Hint: I could be possible that your dialog looks a little bit different.
  8. Open in the toolbar, like in SE16N, the button Spreadsheet…
    image
  9. After select your target format, do you see a native Windows Save as dialog or an SAP dialog?
  10. Don’t forget to deactivate the script recording.

I tried this way on an older SAP system an on a current SAP system, but with the same version of the SAP GUI for Windows and with different themes. The older SAP system opens a native Windows Save as dialog, the newer SAP system opens the scriptable SAP dialog.

So it seems which dialog is opened has something to do with a backend component or configuration.
It seems that has nothing to do with SE16 (or SE16N) itself.
Please let us know your results of the steps above. It is very interesting to know the behavior of your system.

Thanks and best regards
Stefan

Hi Stefan
I’m applying SE16 authorization, then I will give you feedback.

1 Like

Hi Stefan,
I am facing same problem like BingShui. I tried your instruction. I can click on the export button and the save as dialog prompt as normal. How can we proceed?

If I manually run the sequence manually and input the export file name manually, data will be exported to Excel successfully and the UIPath will prompt error as below
image

1 Like

@LIM_ENG_KEONG

Hello Lim,
thank you very much for your reply. I will take a look at it and post my result here.
Best regards
Stefan

@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.

1 Like

Hi Stefan,
Thank you for your support. I am using SAP_BASIS 740.

So how can we move forward?

1 Like

@LIM_ENG_KEONG

Hello Lim,

thanks for your reply.

Now we know that between SAP_BASIS release 740 PL3 and 751 PL19 a change has been made to the dialog for XML export in ALV whether SAP GUI Scripting is used or not. This is a very important insight @LevKushnir.

How many records do you want to export from your table?

I tried the same approach as you and it works so far, as long as the dialog appears within the timeout of 30 seconds. The Save as… dialog is a normal window and can also be treated with the same automatisms. The only difference here is that the SAP backend prepares the data for export. If you have a lot of data, this also takes a lot of time. If you exceed the timeout, the error message will appear.

So I assume you want to export a larger amount of data and you are reaching the timeout before the SAP backend prepared the data. If this is the case you can find a great discussion, to handle this kind of requirement, here: How to Pause Automation Until Required Window Appears.

@bingshui-hl could that also been the reason for you?

Let us know your results.

Best regards
Stefan

1 Like

Hello Stefan
my component version as attached

image

Maybe I’m not descript my problem clearly, my Save as dialog can popup, after that I want to us “type into” active to write file name in Save as dialog. my exact problem is type into active not work. The process stay at Save as dialog, no stop and no error message.

1 Like

Hello Stefan and Lev
Good news, I use right “click” instead " Select Menu Item" active to download data, than the process go smoothly.

1 Like

Hi Stefan,
In my sample code, only < 10 records to be export. The Save As dialog actually prompted almost immediately after the menu selection. The problem is the automation process just stop when the Save As dialog box prompt, and then nothing happened. the TypeInto (change file name) and Click (Save) event is not carry out. seems like the robot is not able to control the Save As dialog box…

1 Like

hello Lim
Do you also use SAP activities? Or you can try others instead.

1 Like

Hi BingShui,
For the menu i am using SAP activity. after the Save As dialog box, i just use the normal TypeInto and Click activities.
What other activities i can use to download data from SAP into Excel file in UIPath?

1 Like

right click the data you want to download, select local file/spreadsheet…
use click instead SAP activities.

1 Like

Hi BingShui,
I see. Ok i will try this out. Thanks for your advise.

1 Like

@bingshui-hl @LIM_ENG_KEONG

Hello Bingshui and Lim,
I tried that and it works without any problems. Here my approach.

The Save as… dialog is in the context of the download of XML files from an SAP system no problem.

Please post the parts of you XAML file which contains the error, so we can take a look at it.

Best regards
Stefan

Hi BingShui,
I am able to call the Save As dialog box using the right mouse click method. However still i cannot input the file name. I use TypeInto event to change the file name directly but nothing happen. Then i use the Send Hot Key event (Alt+n) to move the cursor to the file name column. But the robot automatically save the default file name “Export.xlsx” and system prompt me “Export.xlsx” already existed error although i actually use TypeInto event to replace the filename. Did you change the file name when you export to Excel? how do you did it?
image

Good day all,
It is working by using the right click options.
thank you for your help.

1 Like