Application Development 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: 

Upload a ZIP file to Application Server

anurag_singh16
Participant
0 Kudos

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

Tomas_Buryanek
Active Contributor

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

raymond_giuseppi
Active Contributor
0 Kudos

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

0 Kudos

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.

0 Kudos

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)

anurag_singh16
Participant
0 Kudos

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.

Tomas_Buryanek
Active Contributor

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

monalisa_biswal
Contributor
0 Kudos

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.