data file(100) value '.\myfile'.
data num type string.
open dataset file for output in text mode encoding default.
close dataset file.
then change the the read_data as:
class-data: num type string.
find and change all read_data to num.
Frage
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:\Users\tgbtstj3\Desktop\ZzZzZz.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.
here is my code, i just started abap programming and wanted to make a small program to learn... but i m stuck at reading txt file from my local machine and i cant proceed... the error says file is not open... and exception catched by cx_sy_file_open_mode
Lösung 2
data file(100) value '.\myfile'.
data num type string.
open dataset file for output in text mode encoding default.
close dataset file.
then change the the read_data as:
class-data: num type string.
find and change all read_data to num.
Andere Tipps
The statement OPEN DATASET
is used to access a file on the application server. To access the front-end, use the methods of the class CL_GUI_FRONTEND_SERVICES
. For an example, check the report GRAPHICS_IGS_ZIPPER_DEMO
.