文章转自 http://blog.csdn.net/zhongguomao/article/details/8736557
Report z_barry_test.
DATA: size TYPE i.
CALL METHOD cl_gui_frontend_services=>file_get_size
EXPORTING
file_name = ‘C:\fangwen.bmp’
IMPORTING
file_size = size
EXCEPTIONS
file_get_size_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5 .
CALL METHOD cl_gui_cfw=>flush.
WRITE size.
***或者
DATA: info_obj LIKE obj_record.
CREATE OBJECT info_obj ‘SAPINFO’ NO FLUSH.
CALL METHOD OF info_obj ‘GetFileSize’ = size
EXPORTING #1 = ‘C:\fangwen.bmp’ .
WRITE size.