2007 Aug 31 8:13 AM
Hi all .... I am using the following code.
its not giving any error and file is also getting created but when we view the file in AL11 the file dosnet shows the data updated and gives a message that the data in the file cant be viewed.
OPEN DATASET i_file FOR OUTPUT IN BINARY MODE .
IF sy-subrc EQ 0.
LOOP AT i_record INTO wa_record .
TRANSFER wa_record-FELD1 TO i_file.
IF sy-subrc NE 0 .
RAISE open_dataset_no_authority.
ENDIF.
ENDLOOP.
ELSE.
IF sy-subrc NE 0 .
RAISE error_opening_file.
ENDIF.
ENDIF.
Thanks in advance,
Naval Bhatt
Hi all .... I am using the following code.
its not giving any error and file is also getting created but when we view the file in AL11 the file dosnet shows the data updated and gives a message that the data in the file cant be viewed.
OPEN DATASET i_file FOR OUTPUT IN BINARY MODE .
IF sy-subrc EQ 0.
LOOP AT i_record INTO wa_record .
TRANSFER wa_record-FELD1 TO i_file.
IF sy-subrc NE 0 .
RAISE open_dataset_no_authority.
ENDIF.
ENDLOOP.
ELSE.
IF sy-subrc NE 0 .
RAISE error_opening_file.
ENDIF.
ENDIF.
Thanks in advance,
Naval Bhatt
2007 Aug 31 8:21 AM
Hello Naval,
When you are using a dataset... first you have to lock it. after your usage you have to unlock it. The property CONSISTENCY.
I think your problem occurs due to.. already some other user is using that dataset.
Reward If Useful.
Regards
--
Sasidhar Reddy Matli.
2007 Aug 31 8:30 AM
Hi,
you should add tha statement close dataset like in the code below , else it won't release the lock to the file.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT gt_fichier INTO gs_fichier.
TRANSFER gs_fichier TO p_file.
ENDLOOP.
<b> CLOSE DATASET p_file.</b>
2007 Aug 31 8:35 AM
Hi...Naval...
this may be bcoz you opened the file in BINARY mode.
In this mode records are not transferred line be line.
So you can use.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
Try it...
Regards
Varma
2007 Aug 31 8:35 AM
Hi Naval,
Refer this code :
open dataset i_files for output in text mode encoding default.
loop at i_data into wa_data.
transfer wa_data to i_files.
endloop.
close dataset i_files.
if sy-subrc = 0.
message i001.
endif.
clear files.
Reward points if helpful.
Regards,
Hemant
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |