將檔案轉換為 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

以上程式碼片段只是眾多可能的方法之一。你可以使用相同的方法擴充套件或衍生功能。

更新於: 05-12-2019

717 次瀏覽

開啟你的 職業生涯

透過完成課程獲得認證

開始吧
廣告