ABAP Web Dynpro – File Download SNAFU

Well, I just spent the better part of 20 hours hacking out my latest issue.  In my Rapier web application, one of the cool features I provide is the ability to download an output document from SAP.  Say for example, a quotation or order confirmation.  Well, I was using some fancy trick that converts the spool to PDF, then using the UI Element File Download.  Everything was great in testing.  No problems.  Then a couple weeks ago, I started updating all my documentation.  I came to do a screen shot of this and it it came out in jiberish.  It happened that I was using Firefox.  I tried it, and it worked fine on Internet Explorer, but all the other browsers displayed the text, instead of the pdf…  WTF!!!

So I did my due diligence, and hunted Google long and hard, hoping for a clue.  Nothing jumped out at me.  So, I then applied the latest support packs to my system.  No change.  Then I thought, maybe the kernel needs an update…  no change…  crap.  That burned through a lot of hours in SGEN time, downloading files, system down time, etc…  all for nothing (well, not nothing, but not the result I wanted).

Finally, last night, I decided to look at the UI Element itself, and what I was mapping to it.  I turned out, I was mapping a blank value to MIME_TYPE.  Interestingly, IE was smart enough to recognize the PDF, but none of the other browsers were.  Since all my dev work was on IE, and much of my testing as well, I missed this little fact.  As soon as I added application/pdf to that field…  magically, it began working on all my browsers again.  Woohoo!!!

Now, I hope you can learn from me again… first off, test your WDP on multiple browsers, unless you know you’re only going to support one browser.  This can’t be done in a customer facing application.  Second, MIME_TYPE makes all the difference.  It explicitly tells the system how to render the file.  Don’t take it for granted.

Thanks for reading,

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top