report try1.
class register definition.
public section.
methods: constructor.
class-data: read_data type pa0008-bet01, "i tried string first, but i found this one
endclass. "still doesnt work
class register implementation.
method constructor.
data sometext(100) value 'C:Userstgbtstj3DesktopZzZzZz.txt'.
open dataset sometext for input in text mode encoding default.
do.
read dataset sometext into read_data.
if sy-subrc <> 0.
exit.
endif.
close dataset sometext.
write / read_data.
enddo.
endmethod.
endclass.
data reg type ref to register.
START-OF-SELECTION.
create object reg.
这是我的代码,我刚开始ABAP编程,想做一个小程序来学习......但是我无法从本地计算机读取 txt 文件,无法继续......错误显示文件未打开...和cx_sy_file_open_mode捕获的异常
语句 OPEN DATASET
用于访问应用程序服务器上的文件。要访问前端,请使用类CL_GUI_FRONTEND_SERVICES
的方法。有关示例,请查看报告GRAPHICS_IGS_ZIPPER_DEMO
。
data file(100) value '.myfile'.
data num type string.
open dataset file for output in text mode encoding default.
close dataset file.
然后将read_data更改为:
class-data: num type string.
查找所有read_data并将其更改为 NUM。