-
Notifications
You must be signed in to change notification settings - Fork 1
/
z_filesample__read_file.prog.abap
36 lines (28 loc) · 1.26 KB
/
z_filesample__read_file.prog.abap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
*&---------------------------------------------------------------------*
*& Report Z_FILESAMPLE__READ_FILE
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT z_filesample__read_file.
TYPES:
tv_binary_line TYPE x LENGTH 1000.
DATA:
gt_itab TYPE STANDARD TABLE OF tv_binary_line,
gv_dest TYPE ze_destination.
PARAMETERS:
p_path TYPE string LOWER CASE,
p_gui RADIOBUTTON GROUP a,
p_sap RADIOBUTTON GROUP a.
START-OF-SELECTION.
gv_dest = zcl_filehandler_base=>get_destination( iv_frontend = p_gui
iv_backend = p_sap ).
* Read data to internal type
DATA(go_file_internal) = zcl_filehandler_base=>create( iv_fullpath = p_path
iv_destination = gv_dest ).
go_file_internal->read_file( ).
* Read data to object-external table
DATA(go_file_global_table) = zcl_filehandler_base=>create( iv_fullpath = p_path
iv_destination = gv_dest ).
GET REFERENCE OF gt_itab INTO go_file_global_table->mt_content.
go_file_global_table->read_file( iv_read_as_binary = 'X' ).
WRITE: / 'Done'.