Page tree
Skip to end of metadata
Go to start of metadata


More and more customers complain about the creation of a local copy, if you display an original in a DMS transaction. This copy is put on the user's PC and normally remains there also after closing the display. As this is causing a loss of space a lot of customer want to avoid this creation process.


 To achieve this there exists the BAdI method DOCUMENT_FILES01~AFTER_START_APPL, where you can have an implementation like the following, which might help to solve your problem. This deletes the file even when the user is viewing the file. So no copy will be left on the PC of the user.

  DATA :
         l_str_file  TYPE string,
         l_i_retval      TYPE i.

  l_str_file = TARGET_FILE-FILENAME.

  CALL METHOD cl_gui_frontend_services=>file_delete
          filename             = l_str_file
          rc                   = l_i_retval
          file_delete_failed   = 1
          cntl_error           = 2
          error_no_gui         = 3
          file_not_found       = 4
          access_denied        = 5
          unknown_error        = 6
          not_supported_by_gui = 7
          wrong_parameter      = 8.



  1. Former Member

    When this is implemented, is it still possible to do redlining with the ECL viewer?

  2. Unknown User (c56t6dx)

    I find this doesnt work as the application is still open and the file cant be deleted because its being used by the application, is this correct?

  3. This works with files opened within the SAP GUI using "%SAP-OFFICE-INTEGRATION.INPLACE%" but as John mentioned earlier when the GUI passes the filename to another application it either cannot be deleted by this BAdi (due to the file lock) or with slow loading applications (e.g. powerpoint) the BAdi deletes it before the application loads and opens it.

    We have multiple viewers (ECL & AutoVue) so I plan to add a method that checks the Application Types config to decide if this file_delete method should be called.

  4. Unknown User (101d16gcm)

    Did anybody find solution for this? The files are not deleted since its still being used, just like John said.

    Sorry, my Basis guy put a trace log on the SAP RFCHTTP, thus the issue.Once he removed the trace, no more files!! (big grin)