cancel
Showing results for 
Search instead for 
Did you mean: 

problem to display a binary in a browser window via cl_wd_runtime_services

Former Member
0 Kudos

Hello,

I have a problem to display a binary in a browser window via cl_wd_runtime_services=>attach_file_to_response( ). In our szenario a user interaction triggers a handler using the above mentioned method and then the following happens:

a) when using IE 7 a new tab opens quickly but closes right away (after a fraction of a second) and nothing else happens. If I log this with an Http-logging tool I can see that the binary content is downloaded with an according GET-request; however an export of the binary stream shows the binary is incomplete.

b) when using Mozilla Firefox a new tab opens and closes as with IE, but an open/save-dialog is displayed afterwards and I can save/open the binary with a pertaining program and everything works fine. This functions regardless of the mimetype (gif, jpeg, pdf..).

Does anybody have an idea how to solve this issue (ähm.. recommending to use Firefox is not actually a solution ?

Thanks in advance,

Sebastian

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

>

> a) when using IE 7 a new tab opens quickly but closes right away (after a fraction of a second) and nothing else happens.

This is an old thread, but we were experiencing the same problem and thought it worth shaing our findings. One of our guys did some poking around and found that the issue is caused by security settings in IE.

In IE7:

1. File download prompting must be enabled.

  • Go: Tools -> Internet Options.

  • Choose "Security" tab.

  • Choose "Trusted Sites".

  • Press "Custom Level..." button.

  • Locate "Automatic prompting for file downloads" under "Downloads".

  • Change this setting to "Enable".

2. If it is still not working, try making the site a trusted site.

  • Go: Tools -> Internet Options.

  • Choose "Security" tab.

  • Choose "Trusted Sites".

  • Press "Sites" button.

  • Add the current site if necessary.

Hope others may find this helpful.

Regards,

Grogan

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Does this problem happen in IE for all different MIME Types? I can't recreate your problem as the same functionality works perfectly fine in my installation of IE. Do you have any browser plug-ins - like Anti-Virus scanners that might be interupting?

>however an export of the binary stream shows the binary is incomplete.

This could be indicative of the problem or it might be perfectly normal. What trace tool are you using? It might just be the cause of a multi-part MIME.

Can you download attachments in IE from other websites? There really isn't anything special that SAP is doing in Web Dynpro from a browser side.

Former Member
0 Kudos

Hello Thomas, thanks for your answer.

>

> Does this problem happen in IE for all different MIME Types? I can't recreate your problem as the same functionality works perfectly fine in my installation of IE.

It does happen for Gif-, Jpeg- and Pdf-binaries (other Mime-types I haven't tested yet) and it is IE 7 I am using.

> Do you have any browser plug-ins - like Anti-Virus scanners that might be interupting?

There are no relevant (as far as I can tell) plug-ins especially no anti-virus scanners loaded.

> >however an export of the binary stream shows the binary is incomplete.

> This could be indicative of the problem or it might be perfectly normal. What trace tool are you using?

> It might just be the cause of a multi-part MIME.

The trace-tool is HttpWatch.

I think this correlates with the fact that the tab closes right away (i.e. before the stream has been downloaded completly).

> Can you download attachments in IE from other websites? There really isn't anything special that SAP is doing in Web Dynpro from a browser side.

I can download/open Pdfs from SDN for example

Unfortunately I still haven't got a clue what happens. The code-snipplet producing the response looks like this

METHOD onactionopen_document .

  DATA: file TYPE zrms_st_file.

  file = wd_this->get_file( ).

  cl_wd_runtime_services=>attach_file_to_response(
      i_filename      = file-filename
      i_content       = file-binary
      i_mime_type     = file-mimetype
      i_in_new_window = abap_true ).

ENDMETHOD.

where the type zrms_st_file has three components: binary (type tr_xstring), filename and mimetype (both dstring). Debugging (breakpoint right before method is called) shows that the mimetype is correct.

Regards,

Sebastian

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

About all I can tell you at this point is to open a support message.