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

OPENDATA SET creating file error

Former Member
0 Likes
887

Hi experts,

i am working on creating a text file in Application server using OPNDATASET. i have codes as below:

path = /user/sap/data/txt

OPEN DATASET path FOR OUTPUT IN text MODE .

loop at t_cmex.

transfer t_cmex to path.

endloop.

close dataset path.

but when the open data statment executes its gving sy-subrc = 8 and not creating the file.

plz help me with the same.

mahesh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
827

Hi,

The file path is case sensitive. Declare it as follows:

data : input type cffile-filename obligatory default '/usr/sap/work/BPFILES.txt'.

Hi experts,

i am working on creating a text file in Application server using OPNDATASET. i have codes as below:

path = /user/sap/data/txt

OPEN DATASET path FOR OUTPUT IN text MODE .

loop at t_cmex.

transfer t_cmex to path.

endloop.

close dataset path.

but when the open data statment executes its gving sy-subrc = 8 and not creating the file.

plz help me with the same.

mahesh

6 REPLIES 6
Read only

Former Member
0 Likes
827

Hi,

How are you declaring the variable path? Also check if you have appropriate authorizatoin for creating a file.

Vikranth

Read only

former_member848108
Active Participant
0 Likes
827

Hi,

Your filepath seems to be incomplete, I suggest you to set your path with an explicit file extension such as;

path = /user/sap/data/test.txt

And make sure that necessary authorizations have been granted to write on that filepath.

I hope it helps.

Ozcan.

Read only

Former Member
0 Likes
827

Hi,

data: V_PHYFIL_CSV like V_EXCEL_STRING value

'
Sapbwgrp\rice\IN\inv\BI_Cycle_Count.csv'.

OPEN DATASET v_phyfil_csv FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

See this is working at my end, check out for the file path.

Thanks,

Krishna

Read only

venkat_o
Active Contributor
0 Likes
827

Hi Mahesh, You can try like below. At least you can come to know what causing the problem.


DATA : msg TYPE string.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT MESSAGE msg.
IF sy-subrc NE 0.
  WRITE msg.
ELSE.
  "Your code
ENDIF.
Thanks Venkat.O

Read only

Former Member
0 Likes
828

Hi,

The file path is case sensitive. Declare it as follows:

data : input type cffile-filename obligatory default '/usr/sap/work/BPFILES.txt'.

Read only

0 Likes
827

Hi mahesh,

loop at tcmex.

concatenate tcmex-field1

tcmex-field2

tcmex-field3

into v_string separated

by cl_abap_char_utilities=>horizontal_tab.

transfer v_string to path.

endloop.