2025 Oct 10 4:42 PM
This is a tip I would like to share with you.
We use a version of SAP under Unix wich doesn't allow us to use OPEN DATASET on files with spaces in their names (unicode). You can use the FILTER on OPEN DATASET to copy the file to a temporary folder with a compliant name like this :
CONCATENATE '/tmp/' sy-uname '-' filename INTO filename.
* path and file name is surrounded by doubles quotes
CONCATENATE 'cat "' fullname '"' INTO lv_command.
* Read and write with FILTER
OPEN DATASET filename FOR OUTPUT FILTER lv_command.
IF sy-subrc = 0.
* the result of the command was writen directely to filename
CLOSE DATASET filename.
ENDIF.
** Here code to open and read the temporary file
. . .
2025 Oct 10 6:38 PM
Thanks for the trick.
What error message is returned by OPEN DATASET if you use the addition MESSAGE lv_message ? (without using FILTER)
What is your exact Unix system? (information in menu System > Status).
Do you have the same problem with space if you write to a path in classic Unix folders like /tmp, etc. ?
You can also use a valid name then after you have closed the file, run a Unix command to rename the file (via SXPG_COMMAND_EXECUTE).
See also the notes 27 - Recommendations for ABAP file interface - SAP for Me (side effects when using FILTER, NFS, UNC, etc.)