Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

error in opening dataset

Former Member
0 Likes
303

Hi,

i am getting a dum in using this code, the says the file is not yet opened. what could be the reason? thansk!

DATA : v_fpath TYPE salfile-longname VALUE

'd:\testing\itab_bsak.xls'.

DATA : BEGIN OF i_records OCCURS 0,

rec TYPE string ,

END OF i_records.

DATA : BEGIN OF it_input occurs 0,

rec type string,

END OF it_input.

OPEN DATASET v_fpath FOR INPUT IN TEXT MODE encoding default.

DO.

READ DATASET v_fpath INTO i_records-rec .

ENDDO.

CLOSE DATASET v_fpath .

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
282

Hi check this code:

IF NOT p_ufile IS INITIAL.
OPEN DATASET p_ufile FOR INPUT IN TEXT MODE.
IF sy-subrc NE 0.
EXIT.
ENDIF.

DO.
READ DATASET p_ufile INTO wa_file.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ASSIGN wa_file TO <wa_table>.
APPEND <wa_table> TO p_table.
CLEAR wa_file.
ENDDO.

CLOSE DATASET p_ufile.
ENDIF.

1 REPLY 1
Read only

former_member156446
Active Contributor
0 Likes
283

Hi check this code:

IF NOT p_ufile IS INITIAL.
OPEN DATASET p_ufile FOR INPUT IN TEXT MODE.
IF sy-subrc NE 0.
EXIT.
ENDIF.

DO.
READ DATASET p_ufile INTO wa_file.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ASSIGN wa_file TO <wa_table>.
APPEND <wa_table> TO p_table.
CLEAR wa_file.
ENDDO.

CLOSE DATASET p_ufile.
ENDIF.