cancel
Showing results for 
Search instead for 
Did you mean: 

attach_file_to_response and Zip-Files

Denis_Müller
Participant
0 Kudos

Hello

is there any way to open saved zip-files with the method ATTACH_FILE_TO_RESPONSE

the class of the method is CL_WD_RUNTIME_SERVICES

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Denis,

do you want to send the binary file data stored on the application server to the client, in a WD4A application? Then of course you can use the method you mentioned. Just read the data in binary mode and use this method to send it to the client.

Eventually you have to convert the binary data to Unicode, then do something like this:

lo_conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
lo_conv_out->convert( EXPORTING data = lv_data_from_file IMPORTING buffer = lv_content ).
"here you can call cl_wd_runtime_services=>attach_file_to_response now
"use lv_content for method's parameter i_content

Hope that helps!

Kind regards, Matthias

Denis_Müller
Participant
0 Kudos

i don't understand what to do with your code.

i have my zip-file as xstring in a variable.

in the call method of attach_file_to_response i need the parameter i_mime_type.

what is the type of zip in this case.

e.g. for word it is application/msword

that is my problem

Former Member
0 Kudos

I see, you need "application/zip" as mime type.

Kind regards, Matthias

Denis_Müller
Participant
0 Kudos

ok, that works fine.

can i find out the type of the file when i have only the xstring?

Former Member
0 Kudos

I don't think so, you have to know what file it is.

If done, please close question and reward with points.

Kind regards, Matthias

Former Member
0 Kudos

Hi,

I have a requirement similar to this.

I will get an excel sheet when i run my report program.

It send the excel sheet directly to the mail id.

But now i want to ZIP the file and then i want to send this ZIP file.

Can you please help with a sample code to get this.

Thanks in advance.

Regards,

sasi

Former Member
0 Kudos

Hi Sasi,

I would recommend that you start a new thread for a new question. It is likely that many people ignore already closed threads, so your question is missed by many here in the forums.

Kind regards, Matthias

Answers (1)

Answers (1)

Yashpal
Active Contributor
0 Kudos

Hi ,

see the class .. CL_ABAP_ZIP

Regards

Yash

Denis_Müller
Participant
0 Kudos

this class can't help me

the zip-file is in the R/3-System and i want download it to my pc.