2006 Dec 12 11:55 AM
Hi all,
can i write the data to more than one Dataset at a time ?
if Yes... how ? If not why ?
Thanks in Advance
Malli...
2006 Dec 12 11:59 AM
Hello,
You can write to more than one dataset at a time.
data text(100).
open dataset data1 for output.
open dataset data2 for output.
transfer text to data1.
transfer text to data2.
Regards,
Manoj
Hi all,
can i write the data to more than one Dataset at a time ?
if Yes... how ? If not why ?
Thanks in Advance
Malli...
2006 Dec 12 11:57 AM
open multiple datasets
and then use
TRANSFER <FIELD> TO <FILENAME>
then close the datasets.
Message was edited by:
Elanchezhian Balasubramanian
2006 Dec 12 11:58 AM
hi,
Yes u can write to no. of datasets in a single execution, but take care of whether you have authorization to write to the particular folder.
2006 Dec 12 11:59 AM
Hello,
You can write to more than one dataset at a time.
data text(100).
open dataset data1 for output.
open dataset data2 for output.
transfer text to data1.
transfer text to data2.
Regards,
Manoj
2006 Dec 12 11:59 AM
No, But we can write the same value in two Data sets one after another.
NO, Because, if you open one data set we can't open another before closeing the first one.
Regards,
Sunil.Y
2006 Dec 12 12:00 PM
hI Krish.
check this..
open dataset...
read dataset...
close dataset...
DATA: itab TYPE STANDARD TABLE OF mara,
wa_itab TYPE mara.
SELECT * FROM mara INTO TABLE itab WHERE matnr > '000000000000001000'
AND matnr < '000000000000009010'.
OPEN DATASET 'sharat.pm' FOR APPENDING IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
LOOP AT itab INTO wa_itab.
TRANSFER wa_itab-matnr TO 'sharat.pm'.
ENDLOOP.
ENDIF.
CLOSE DATASET 'sharat.pm'.
REWRD IF USEFULL
2006 Dec 12 2:17 PM
Hi Krish, try this:
REPORT YROBTEST.
DATA: dataset_one LIKE rlgrap-filename VALUE '.prova1.txt',
dataset_two LIKE rlgrap-filename VALUE '.prova2.txt'.
DATA: begin of itab occurs 10,
line(100) TYPE C,
end of itab.
DO 10 TIMES.
TRANSLATE itab-line USING ' 0'.
APPEND itab.
ENDDO.
TRY.
OPEN DATASET dataset_one FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
OPEN DATASET dataset_two FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT itab.
TRANSFER: itab TO dataset_one,
itab TO dataset_two.
ENDLOOP.
CATCH: cx_sy_file_authority,
cx_sy_too_many_files,
cx_sy_file_open_mode.
endtry.
CLOSE DATASET dataset_one.
CLOSE DATASET dataset_two.
Remember that you can open up to 100 datasets per session.
Hope this helps!
R.