將檔案轉換為 SAP ABAP 中的位元組陣列
以下是一個程式碼片段,用於執行相同操作。
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
以上程式碼片段只是眾多可能的方法之一。你可以使用相同的方法擴充套件或衍生功能。
廣告