Skip to Content
Technical Articles

Note: 2547717 – ITS Up/Down: Only Z: drive available no local drives (like C:)

The note describes, only Z: drive is available to upload/download files, when on ITS (HTML WebGUI).

Example of a Z: drive download:

Yet, with APC, SAP has implemented a seamless method to generate a printout and download that print file, without using Z: drive (Ref: 2159422 – Front-end printing for SAP GUI for HTML with ABAP Push Channel). So, I believe, the restriction that is mentioned in 2547717, can easily be circumvented, especially for downloading files.

Below is how I downloaded files, without Z: drive. This may be just considered as an example to motivate SAP to standardize a better approach, than using Z: drive. Because of the variables available to me from an ABAP standpoint, I couldn’t find a way to make the download behavior same in IE (Version 11.2791.14393.0) and Chrome (Version 72.0.3626.109), using the same code. This is where I feel, SAP can do better, without depending on Z: drive.

data: maktlines type standard table of makt,
      url type string,
      cached_response type ref to if_http_response,
      salvobject type ref to cl_salv_table,
      filexstring type xstring.

*Build a simple file with some data in it
select * up to 10 rows from makt into table maktlines.
cl_salv_table=>factory( importing r_salv_table = salvobject changing t_table = maktlines ).
filexstring = salvobject->to_xml( 10 ) .

*Build a dynamic URL
url = |/sap/public/| && cl_system_uuid=>create_uuid_x16_static( ).

*Load the file into the URL
cached_response = new cl_http_response( add_c_msg = 1 ).
cached_response->set_status( code = 200 reason = 'OK' ).
cached_response->set_header_field( name = if_http_header_fields=>cache_control
                                   value = 'no-cache' ).
cached_response->set_header_field( name = if_http_header_fields=>content_disposition
                                   value = |attachment;filename=testfile.xlsx| ).
cached_response->set_header_field( name = if_http_header_fields=>content_type
                                   value = |application/octet-stream| ).
cached_response->set_data( data = filexstring 
                           length = xstrlen( filexstring ) ).
cached_response->set_compression( options = cached_response->co_compress_based_on_mime_type ).
cached_response->server_cache_expire_rel( expires_rel = '60' ).
cl_http_server=>server_cache_upload( url = url 
                                     response = cached_response ).

*Note the changes in below screenshot
url = |javascript:window.open("{ url }");|.

*Open the newly built URL
call function 'ITS_BROWSER_WINDOW_OPEN'
  exporting
    url               = url
*Note the changes in below screenshot
    window_name       = '_self'
  exceptions
    error_message     = 1
    its_not_available = 1
    others = 2.

Note the following changes required in IE vs Chrome, to make the download behave the same way. For now, since there is no SAP support to handle this automatically, you may configure a parameter ID, that the user can set, for his preference on the browser and change the values accordingly.

Chrome code: (note the marked lines)

IE code: (note the changes to url & window name)

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.