A tool to poll file change and upload changed files automatically as W3MI object. Created mainly to simplify CSS editing in https://github.com/abapGit/abapGit, but can be used for other purposes.
In particular, can be used as a library of file system and mime object tools. Which I actually do in my other project e.g. mockup loader and mockup compiler. See more details below.
Clone the repository to your SAP system using abapGit tool.
Enter filename to poll and target object at selection screen. You can also choose multiple polling pairs. The first pair is remembered in user parameters for the session live time.
Optionally, choose if you want to upload the file to SAP or replace the fronend file before the polling start.
The package contains several useful routines grouped into classes. All routines are static methods. Some of them may raise zcx_w3mime_error
exception (use get_text
to get some description of an error). For more details see implementations directly - the routines are mostly simple convenient wrappers over existing SAP calls. Might happen that I invented bicycle or a couple - sorry if so :)
- zcl_w3mime_storage
read_object(_x)
- read MIME object into raw255 table (or xstring)update_object(_x)
- save raw255 table (or xstring) as a MIME object (must exist already)choose_mime_dialog
- display dialog to choose MIME object. Can be used for F4 search helps. Filters onlyZ
objects.- minor utils like
get_object_info
andcheck_obj_exists
- zcl_w3mime_fs
choose_dir_dialog
,choose_file_dialog
- quick wrappers around cl_gui_frontend methods.read_file(_x)
,write_file(_x)
- quick wrapper to read/write a file, raw255 and xstring versions respectfullyparse_path
- split path into directory, filename and extensionresolve_filename
- split path into directory and filename, if no directory - fallback to SAP GUI default pathpath_join
- join 2 path parts e.g. directory and filename, respecting separators (but ignoring..
at the moment)path_is_relative
- detects if one path is relative to the other (but ignoring..
at the moment)path_relative
- calculates the difference between 2 paths (but ignoring..
at the moment)path_ensure_dir_tail
- ensures dir ends with separator symbol
- zcl_w3mime_utils
download
- save W3MIME object directly to fileupload
- vice versa
- zcl_w3mime_poller
- most complex wrapper. Polls directory (can be multiple) once per given period of time for file changes. If detected fires
changed
event with changed file list. - Usage:
construct
the object (this one is not static) giving the target list and timer interval, assign the event handler tochanged
(and toerror
optionally),start
the poller. - see
zw3mimepoll
program if you are looking for an example. seelcl_poller
class implementation - it contains concrete handling of a more abstractzcl_w3mime_poller
tool
- most complex wrapper. Polls directory (can be multiple) once per given period of time for file changes. If detected fires
- zcl_w3mime_zip_writer
- a wrapper around
cl_abap_zip
. has
- checks of the file exists in zipadd(x), read(x)
- reads write data from zip, methods withoutx
convert the data to string based on encoding specified during instantiationget_blob
- returns xstring of current zip stateis_dirty
- tracks if there has been any changes since lastget_blob
. (add
sets the flag,get_blob
releases it).
- a wrapper around