cancel
Showing results for 
Search instead for 
Did you mean: 

File is not downloading!!!

former_member202077
Participant
0 Kudos

Hello

In my WDA (ABAP) i have a file upload and file download UI elements/functionality, actually, my business requirement is ditto to the below link and hence i did the same in my WDA as suggested in the below wiki link

[url] http://wiki.sdn.sap.com/wiki/display/WDABAP/UploadandDownloadfilesinWebdynproABAP [url]

But, file download is not working (upload is working fine), issues are as below

1) MS-Word with DOC (MS Word 2003 ver.) extension - am getting junk values = same case for Excel XLS extension

2) MS-Word2010 with DOCX extension - some thing else (when we try to download a file from internet, system will popus a dialog box (file download manager) for inputting the proposed file name intended for save on our machine, same dialog box/manager) am getting = same for Excel2010 XLSX extension

Our system config is as below,

We are on ECC 6.0 with NetWeaver 7 EnhP2 with GUI 720

MicroSoft Office Professional Plus 2010

Version: 14.0.6108.5000(32 bit)

Extnsion is DOCX

Not sure whats happening in my case!

For 2003 MS versions am getting junk and for new 2010 MS versions am getting opening of a new dialog popup box(file download manager), wher in all showing XML files!!

Same happening for .MSG extensions

For the rest doc types (TXT, JPG, PDF) its working fine

Note: When i try to click the DOWNLOAD hyperlink (as shown in this wiki) .TXT(good/correct data), MS Word 2003(but junk) are opening in HTML window

Pls. let me know How can i fix it?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Based on the attachment type from the DMS system, try to define the local type for downloading the file.


Case Attachment type.
WHEN 'WWI'.
        SPLIT loc_filename AT '.' INTO TABLE int_doc.
        DESCRIBE TABLE int_doc LINES loc_len.
        READ TABLE int_doc INTO wa_doc INDEX loc_len.
        IF wa_doc = 'docx' OR wa_doc = 'DOCX'.
          loc_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'.
        ELSE.
          loc_type = 'application/msword'.
        ENDIF.
      WHEN 'PDF'.
        loc_type = 'application/pdf'.
      WHEN 'XLS'.
        SPLIT loc_filename AT '.' INTO TABLE int_doc.
        DESCRIBE TABLE int_doc LINES loc_len.
        READ TABLE int_doc INTO wa_doc INDEX loc_len.
        IF wa_doc = 'xlsx' OR wa_doc = 'XLSX'.
          loc_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'.
        ELSE.
          loc_type = 'application/vnd.ms-excel'.
        ENDIF.
      WHEN 'BMP'.
        loc_type = 'image/bmp'.
      WHEN 'JPG'.
        loc_type = 'image/pjpeg'.
      WHEN 'WRD'.
        loc_type = 'text/plain'.
      WHEN 'SIM'.
        CLEAR: loc_len, wa_doc, int_doc.
        SPLIT loc_filename AT '.' INTO TABLE int_doc.
        DESCRIBE TABLE int_doc LINES loc_len.
        READ TABLE int_doc INTO wa_doc INDEX loc_len.
        IF wa_doc = 'pptx' OR wa_doc = 'PPTX'.
          loc_type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'.
        ELSE.
          loc_type = 'application/vnd.ms-powerpoint'.
        ENDIF.
      WHEN 'LIM'.
        loc_type = 'text/html'.
    ENDCASE.

*--To display the content in the same window.
    CALL METHOD cl_wd_runtime_services=>attach_file_to_response
      EXPORTING
        i_filename      = filename value
        i_content       = xstring value
        i_mime_type     = loc_type - gwetting from the case statement
*      i_in_new_window = ABAP_true
*    i_inplace       = ABAP_FALSE
        .

Thanks & Regards,

Raghuram K.R.

former_member202077
Participant
0 Kudos

Thank you.

But, if you check the provided SDN wiki liink, you will understand that, am not doing(addressing the FILE DOWNLOAD requirement) as you suggested(clicking some pushbutton)

The wiki is suggesting to use the in-built function of table's cell's FILE DOWNLOAD option. Anyways, Thank you.

Any help pls? that why am not getting MS-WORD2003(getting junk values), MS-WORD2010 (not at all opening). MS-EXCEL 2010?

former_member202077
Participant
0 Kudos

Thank you, your answer is solved my issue (after changing the requirement that now user okay to click the button).

Thanks again, it saved my time

Answers (2)

Answers (2)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You haven't posted your code for how you are building the XSTRING with the content for the download. If you are getting corrupted data, that seems like the mostly likely place in which to make an error.

former_member202077
Participant
0 Kudos

Thank you, am doing same as suggested in the wiki. Only neglegible difference is, wiki is using a custom data element for storing the FILE_CONTENT in the Z table, but am using standard SAP data element of RAWSTRING type, as below shown

 
In wiki: ls_file_upload-FILE_CONTENTS = ls_n_upload-FILE_CONTENTS.

I am using 'PTRV_WEB_XSTRING' (XSTRING for Transfer of PDF Form), 
its data type is RAWSTRING 

Other than this am not doing any thig else to handle XSTRING, bcz standard SAP's FileUpload UI elemnt is taking care

Pls. suggest me

Thank you

former_member202077
Participant
0 Kudos

Any help pls.?

Thank you

Former Member
0 Kudos

Hi,

To open the MS-WORD 2010 or EXCEL 2010 the file type you need to pass as previously mentioned. When uploading the document try to pass the type as mentioned and open it from the table.

Thanks & Regards,

Raghuram K.R.