Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Upload a ZIP file to Application Server

anurag_singh16
Participant
5,745

Hello,

I have this requirement to upload multiple documents from presentation server to SAP Application server and then from that Application server to email as attachment. So, we are thinking of putting up all files in a ZIP file and upload it, then send this exact ZIPPED file ( which is first uploaded to Application Server ) to concerned person over email through another program.

The upload of ZIP file to Application Server has to be done through ALV cell like this.

Kindly suggest.

Regards,
Anurag Singh

Hello,

I have this requirement to upload multiple documents from presentation server to SAP Application server and then from that Application server to email as attachment. So, we are thinking of putting up all files in a ZIP file and upload it, then send this exact ZIPPED file ( which is first uploaded to Application Server ) to concerned person over email through another program.

The upload of ZIP file to Application Server has to be done through ALV cell like this.

Kindly suggest.

Regards,
Anurag Singh

7 REPLIES 7
Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
3,895

Hello, nice requirement 🙂 Where did you find problem? And which ways did you tried?

-- Tomas --
Read only

RaymondGiuseppi
Active Contributor
3,895

So you use the F4 (ONF4 or similar event) to upload files, and the problem is?

Read only

3,895

The problem is I need some solution to Upload a zipped file containing different types of documents ( like .XLS, .DOC, .PDF, etc ).

And now this zipped file has to be saved in SAP somewhere so that later on I can provide a hyperlink to this zipped file in another ALV Report. When user clicks that hyperlink in ALV, the zipped file can be downloaded to Local PC and the user can see those documents wrapped into the zipped file then.

Kindly suggest.

Read only

3,895

Uploading files is a FAQ, to build a zip, look at classes such as cl_abap_zip, you could also consider GOS or similar tool to store the generated document and provide link. (Use search tool)

Read only

anurag_singh16
Participant
3,895

Hello,

My dear client gave this requirement 😄 :D.

I used GUI Upload but it's restricted to only .txt files which is not my requirement.

Hope you can provide some help.

Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
3,895

GUI Upload is not restricted to only .txt files. It has no problem with a .zip or any other file.

-- Tomas --
Read only

monalisa_biswal
Contributor
3,895

You can use cl_abap_zip class to create zip file.

Following is the sample code to covert text to zip. It returns a binary string which can be written to file.

data: lo_bcs_exception type ref to cx_bcs,
        lex_text         type string,
        l_xstring        type xstring.


  data: l_zipper   type ref to cl_abap_zip,
        filename   type string,
        zip        type xstring,
        filelenght type i.

  try.
      l_xstring = cl_bcs_convert=>string_to_xstring( iv_string = p_output iv_codepage = '4103'  iv_add_bom  = 'X').
      filename = 'alvfile.xls'.
      create object l_zipper.
      l_zipper->add( name = filename  content = l_xstring )."add object to zip
      call method l_zipper->save( receiving zip = zip ). "save zip


    catch cx_bcs into lo_bcs_exception.
      lex_text  = lo_bcs_exception->get_text( ).


  endtry.