2008 Apr 18 7:51 AM
hiiii
i have a question for this piece of code:
OPEN DATASET P_FILE FOR INPUT IN BINARY MODE
the value in P_FILE = /usr/sap/tmp/file
i get sy-subrc 8
when i put value
the value in P_FILE = /usr/sap/tmp/file.dat the sy-subrc = 0.
is this an error in code or when we do the text we must put the .dat extension
because the unit test sript said to run the test without the .dat extension
2008 Apr 18 7:57 AM
Hi,
You must enter the file name with extension, else it wont work.
Remember , its case sensitive.
hiiii
i have a question for this piece of code:
OPEN DATASET P_FILE FOR INPUT IN BINARY MODE
the value in P_FILE = /usr/sap/tmp/file
i get sy-subrc 8
when i put value
the value in P_FILE = /usr/sap/tmp/file.dat the sy-subrc = 0.
is this an error in code or when we do the text we must put the .dat extension
because the unit test sript said to run the test without the .dat extension
2008 Apr 18 7:53 AM
2008 Apr 18 7:57 AM
Hi,
You must enter the file name with extension, else it wont work.
Remember , its case sensitive.
2008 Apr 18 7:57 AM
Hi,
You will need to add extension, because Open dataset...in binary mode will read data as a stream..
Regards,
Mohaiyuddin
2008 Apr 18 7:59 AM
Hi,
without the extension you can not open the file.Because file is in binary mode you have to give .dat.
if you open in tecxt mode give .txt.
Pls reward if useful....
2008 Apr 18 8:14 AM
what if i remove the IN BINARY MODE in code, will it accept without the .dat enven though in unix the full name is file.dat
OPEN DATASET P_FILE FOR INPUT IN BINARY MODE
2008 Apr 18 8:56 AM
Hi Newbie,
When u pass the file path it is necessary to have an extension,
So u will hav to provide the file path which has an extension like .dat, .txt etc.... so that it knows wat is the file type ...
Secondly u use binary mode to read the info byte wise...this is defualt mode for open data set....
Suppose ur requirement is to read data i.e the entire string then u need to use the TExt mode...It will read the entire string till it encounters space or a delimter...
Thanx,
navin.
2008 Apr 18 11:22 AM
i know that in the selection screen i can add the ".dat" myself but because i have receive a template from the funtional to execute the programm without the .dat
what should i do for the programm to accept only "/path/file" instead of "/path/file.dat"
2008 Apr 18 11:32 AM
Hi newbie...
See...jst incase u receive only the path and that will be stored in some variable right...So before you giv that file name widut
the extension.....u can concatenate a variable l_ext which holds .dat to the variable which holds the file path...So ur final variable l_file path contains = "/path/file.dat"
Thanx,
Navin.
2008 Apr 18 8:44 AM
haii,
the problem is in open dataset file name is case sensitive
so while defining parameter for file name add LOWER CASE.
parameter : P_FILE(30) type c LOWER CASE .
thanks and regards
sarath p
2008 Apr 18 9:10 AM
Hi newbie,
Of course you can add the extension yourself if you want. Just check the string in P_FILE and add the ".dat" if it is not there.
Gr.
Richard
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |