2007 Sep 20 5:00 AM
I need to transfer a 0 byte file.
for that I am using the following code.
<b><i>begin of i_zero occurs 0,
dummy,
end of i_zero,
move '' to i_zero-dummy.
append i_zero.
open dataset v_file for output in binary mode.
if sy-subrc eq 0.
loop at i_zero.
transfer i_zero-dummy to v_file.
endloop.
close dataset v_file.</i></b>
but the above code is giving me a 1 byte size file. is there anyway around this to be able to transfer a 0 byte file?
2007 Sep 20 5:04 AM
Hi Prasad
May be you can just open a file and don't transfer anything and close the file.
Something like this,
<b>open dataset v_file for output in binary mode.
close dataset v_file.</b>
Rewards points for all useful answers !!
~Ranganath
I need to transfer a 0 byte file.
for that I am using the following code.
<b><i>begin of i_zero occurs 0,
dummy,
end of i_zero,
move '' to i_zero-dummy.
append i_zero.
open dataset v_file for output in binary mode.
if sy-subrc eq 0.
loop at i_zero.
transfer i_zero-dummy to v_file.
endloop.
close dataset v_file.</i></b>
but the above code is giving me a 1 byte size file. is there anyway around this to be able to transfer a 0 byte file?
2007 Sep 20 5:04 AM
Hi Prasad
May be you can just open a file and don't transfer anything and close the file.
Something like this,
<b>open dataset v_file for output in binary mode.
close dataset v_file.</b>
Rewards points for all useful answers !!
~Ranganath
2007 Sep 20 5:05 AM
Hi Prasad,
I believe, though you are writing a space into dummy it would be occufying 1 byte.
Why don't you just open and close the file. It will create file with 0 bytes.
Try this.
Regards
Surya.
2007 Sep 20 5:11 AM
Try this:
OPEN DATASET v_file FOR OUTPUT IN BINARY MODE.
IF sy-subrc <> 0.
MESSAGE e001(VL) WITH 'File open error'.
ENDIF.
CLOSE DATASET v_file.Don't forget to reward points.
Cheers,
Sougata.
2007 Sep 20 5:17 AM
IF you want to create a file with 0 bytes then why do you want to transfer empty space to your file.
Do it like this...
open dataset v_file for output in binary mode.
if sy-subrc eq 0.
**File opened successfully.
endif.
close dataset v_file.
Regards,
Sairam