Application Development 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: 

open dataset

Former Member
0 Kudos

i have internal table it_output and i want to transfer it_output data to p_file on application server.

How to use open dataset for this ??

1 ACCEPTED SOLUTION

Sm1tje
Active Contributor
0 Kudos

open dataset lv_name for input in text mode encoding default.

lv_name is the name of the path and file.

loop at itab into wa.

transfer wa to lv_name.

endloop.

close dataset lv_name.

F1 help on OPEN DATASET is also possible!!

4 REPLIES 4

Sm1tje
Active Contributor
0 Kudos

open dataset lv_name for input in text mode encoding default.

lv_name is the name of the path and file.

loop at itab into wa.

transfer wa to lv_name.

endloop.

close dataset lv_name.

F1 help on OPEN DATASET is also possible!!

Former Member
0 Kudos

Hi Frds

Check this link

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/open_dat.htm

Reward Me Point

By

Pari

prasanth_kasturi
Active Contributor
0 Kudos

hi,

use the following way

open dataset <filename> for o/p

in {text/binary mode}

encoding default.

regards

prasanth

if the file is not there it creates a file. binary mode is default

Former Member
0 Kudos

l_unix_file = <your filepath on Application server with filename you want to create>

OPEN DATASET l_unix_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

  • Check that file opened without error.

IF sy-subrc NE 0.

<output error message>

ENDIF.

LOOP AT it_output. TRANSFER it_output TO l_unix_file.

ENDLOOP.

CLOSE DATASET l_unix_file.

Regards,

Mohaiyuddin