- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Converting a file into a byte array in SAP ABAP
Here is a code snippet to do the same.
data: f_line type xstring. // to get line by line content data: f_file type table of xstring. // to get the final content data: f_filename type string value 'samplefile.txt'. // store the filename of file data: f_len type i. open dataset f_filename for input in binary mode. // read the binary read dataset f_filename into f_line length f_len. // get the number of lines in the file while f_len > 0. // loop through file line by line append f_line to f_file. read dataset f_filename into f_line length f_len. endwhile. close dataset f_filename // close the dataset
The above code snippet is one of the many possible ways. You can use the same to extend or derive the functionality.
Advertisements
To Continue Learning Please Login
Login with Google