Read binary file from application server

Simple ABAP snippet how to read a binary file from an application server.
  filename     TYPE string,
  buffer       TYPE xstring,
  content      TYPE xstring,
  mlen         TYPE i,
  alen         TYPE i.

filename = '/tmp/file.bin'.
IF sy-subrc = 0.
  mlen = 1024.
  alen = 9999.
  WHILE alen <> 0.
    IF sy-subrc = 0.
      CONCATENATE content buffer INTO content IN BYTE MODE.
  CLOSE DATASET filename.
See other related notes in my infodepot:
Upload Excel file to internal table Save internal table as CSV file delimited by Tab
Full list of examples in my infodepot

If you have a question, have found an error or just want to contact me, please use this form.

Copyright (C) 2018

Disclaimer: I am not affiliated or related to any division or subsidiary of SAP AG.
Trademarks or registered trademarks of any products or companies referred to on this site belong to those companies.
Anyone using the given solutions, is doing it under his/her own responsibility and at own risk.