cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with class cl_wd_runtime_services

Former Member
0 Kudos

Good day experts I am using this class cl_wd_runtime_services to download a Word file into a WebDynpro applications, operating correctly but after I download the file has 0 kb when the actual size is 25kb.

Please help me I hope, this is the code
I am using:


DATA: lv_filename TYPE string,
          lv_ctype   
TYPE string,
          lv_content 
TYPE xstring.

  lv_filename
= 'Anexar.docx'.
  lv_ctype
= 'pdf'.

  cl_wd_runtime_services
=>attach_file_to_response(

           
EXPORTING i_filename = lv_filename

                      i_content 
= lv_content

                      i_mime_type
= lv_ctype

                      i_in_new_window
= abap_true ).


Thanks


Best regards.

Accepted Solutions (0)

Answers (2)

Answers (2)

ramakrishnappa
Active Contributor
0 Kudos

Hi Brujo,

As suggested by Srinivass, use function module   SDOK_MIMETYPE_GET to get mimetype based on file extenstion.

In your case: for "DOCX", mime type should be "application/octet-stream".


The issue here is with lv_content i.e. the content is empty. Hence it is having 0kb.

It should be having file content filled.

Get the content of your file in  xstring format  into lv_content.

Hope this helps you.

Regards,

Rama

former_member219762
Contributor
0 Kudos

Hi,

Use fm SDOK_MIMETYPE_GET to get mime type for given file extension and use that in

cl_wd_runtime_services=>attach_file_to_response. So doc extension file mime type would be 'application/msword',for pdf 'application/pdf'.Minme type is customizable,so use above function module to get mime type.

Regards,

Sreenivas.